Loading Screen with pulsating text, 2 new hairstyles

This commit is contained in:
Monty Marz
2019-11-23 00:51:18 +00:00
parent b804c18eb0
commit 370e94b1ad
9 changed files with 442 additions and 391 deletions

BIN
assets/voxygen/background/bg_load.png (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/voxel/figure/hair/dwarf/female-1.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/figure/hair/elf/male-3.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -113,6 +113,7 @@
Some(("figure.hair.elf.male-0", (2, 1, 1))),
Some(("figure.hair.elf.male-1", (1, -1, 0))),
Some(("figure.hair.elf.male-2", (-2, -4, -7))),
Some(("figure.hair.elf.male-3", (-7, -10, -8))),
],
beard: [None],
accessory: [
@ -150,7 +151,7 @@
beard: [None],
accessory: [
None,
Some(("figure.accessory.elf.warpaint-0", (6, 9, 4))), ]
Some(("figure.accessory.elf.warpaint-0", (6, 9, 5))),]
),
(Dwarf, Male): (
offset: (-6.0, -4.5, -6.0),
@ -193,7 +194,8 @@
head: ("figure.head.dwarf.female", (0, 3, 0)),
eyes: ("figure.eyes.dwarf.female-0", (1, 10, 2)),
hair: [
Some(("figure.hair.dwarf.female-0", (0, 0, -7))),
Some(("figure.hair.dwarf.female-0", (-9, -9, -7))),
Some(("figure.hair.dwarf.female-1", (-9, -9, -7))),
],
beard: [None],
accessory: [

View File

@ -332,10 +332,10 @@ impl Race {
match (self, body_type) {
(Race::Danari, BodyType::Female) => 2,
(Race::Danari, BodyType::Male) => 2,
(Race::Dwarf, BodyType::Female) => 1,
(Race::Dwarf, BodyType::Female) => 2,
(Race::Dwarf, BodyType::Male) => 3,
(Race::Elf, BodyType::Female) => 21,
(Race::Elf, BodyType::Male) => 3,
(Race::Elf, BodyType::Male) => 4,
(Race::Human, BodyType::Female) => 19,
(Race::Human, BodyType::Male) => 17,
(Race::Orc, BodyType::Female) => 1,

View File

@ -98,7 +98,10 @@ impl PlayState for MainMenuState {
global_state.maintain(clock.get_last_delta().as_secs_f32());
// Maintain the UI.
for event in self.main_menu_ui.maintain(global_state) {
for event in self
.main_menu_ui
.maintain(global_state, clock.get_last_delta())
{
match event {
MainMenuEvent::LoginAttempt {
username,

View File

@ -14,6 +14,7 @@ use conrod_core::{
widget::{text_box::Event as TextBoxEvent, Button, Image, List, Rectangle, Text, TextBox},
widget_ids, Borderable, Color, Colorable, Labelable, Positionable, Sizeable, Widget,
};
use std::time::Duration;
widget_ids! {
struct Ids {
@ -83,6 +84,7 @@ image_ids! {
<ImageGraphic>
bg: "voxygen.background.bg_main",
load: "voxygen.background.bg_load",
<BlankGraphic>
nothing: (),
@ -127,7 +129,6 @@ pub enum PopupType {
Error,
ConnectionInfo,
}
pub struct PopupData {
msg: String,
button_text: String,
@ -145,8 +146,10 @@ pub struct MainMenuUi {
server_address: String,
popup: Option<PopupData>,
connecting: Option<std::time::Instant>,
connect: bool,
show_servers: bool,
show_disclaimer: bool,
time: f32,
}
impl MainMenuUi {
@ -177,12 +180,16 @@ impl MainMenuUi {
popup: None,
connecting: None,
show_servers: false,
connect: false,
time: 0.0,
show_disclaimer: global_state.settings.show_disclaimer,
}
}
fn update_layout(&mut self, global_state: &mut GlobalState) -> Vec<Event> {
fn update_layout(&mut self, global_state: &mut GlobalState, dt: Duration) -> Vec<Event> {
let mut events = Vec::new();
self.time = self.time + dt.as_secs_f32();
let fade_msg = (self.time * 2.0).sin() * 0.5 + 0.51;
let (ref mut ui_widgets, ref mut _tooltip_manager) = self.ui.set_widgets();
let version = format!(
"{}-{}",
@ -196,9 +203,6 @@ impl MainMenuUi {
\n\
The name you put in will be your character name ingame.\n\
\n\
Starting Singleplayer needs some time to load.\n\
During this time the game may appear unresponsive.\n\
\n\
As of now you can't save your characters.\n\
Changing their appearance is possible though.";
@ -222,10 +226,82 @@ impl MainMenuUi {
// Background image, Veloren logo, Alpha-Version Label
Image::new(self.imgs.bg)
Image::new(if self.connect {
self.imgs.load
} else {
self.imgs.bg
})
.middle_of(ui_widgets.window)
.set(self.ids.bg, ui_widgets);
// Version displayed top right corner
Text::new(&version)
.color(TEXT_COLOR)
.top_right_with_margins_on(ui_widgets.window, 5.0, 5.0)
.font_id(self.fonts.cyri)
.font_size(14)
.set(self.ids.version, ui_widgets);
// Popup (Error/Info)
if let Some(popup_data) = &self.popup {
let text = Text::new(&popup_data.msg)
.rgba(1.0, 1.0, 1.0, if self.connect { fade_msg } else { 1.0 })
.font_id(self.fonts.cyri);
Rectangle::fill_with([65.0 * 6.0, 140.0], color::TRANSPARENT)
.rgba(0.1, 0.1, 0.1, if self.connect { 0.0 } else { 1.0 })
.parent(ui_widgets.window)
.up_from(self.ids.banner_top, 15.0)
.set(self.ids.login_error_bg, ui_widgets);
Image::new(self.imgs.info_frame)
.w_h(65.0 * 6.0, 140.0)
.color(Some(Color::Rgba(
1.0,
1.0,
1.0,
if self.connect { 0.0 } else { 1.0 },
)))
.middle_of(self.ids.login_error_bg)
.set(self.ids.error_frame, ui_widgets);
if self.connect {
text.mid_top_with_margin_on(self.ids.error_frame, 10.0)
.font_id(self.fonts.alkhemi)
.bottom_left_with_margins_on(ui_widgets.window, 60.0, 60.0)
.font_size(70)
.set(self.ids.login_error, ui_widgets);
} else {
text.mid_top_with_margin_on(self.ids.error_frame, 10.0)
.font_id(self.fonts.cyri)
.font_size(25)
.set(self.ids.login_error, ui_widgets);
};
if Button::image(self.imgs.button)
.w_h(100.0, 30.0)
.mid_bottom_with_margin_on(
if self.connect {
ui_widgets.window
} else {
self.ids.login_error_bg
},
10.0,
)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label_y(Relative::Scalar(2.0))
.label(&popup_data.button_text)
.label_font_id(self.fonts.cyri)
.label_font_size(15)
.label_color(TEXT_COLOR)
.set(self.ids.button_ok, ui_widgets)
.was_clicked()
{
match popup_data.popup_type {
PopupType::ConnectionInfo => {
events.push(Event::CancelLoginAttempt);
}
_ => (),
};
self.popup = None;
};
}
if !self.connect {
Image::new(self.imgs.banner)
.w_h(65.0 * 6.0, 100.0 * 6.0)
.middle_of(self.ids.bg)
@ -243,13 +319,6 @@ impl MainMenuUi {
.mid_top_with_margin_on(self.ids.banner_top, 40.0)
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.95)))
.set(self.ids.v_logo, ui_widgets);
// Version displayed top right corner
Text::new(&version)
.top_right_with_margins_on(ui_widgets.window, 5.0, 5.0)
.font_size(14)
.font_id(self.fonts.cyri)
.color(TEXT_COLOR)
.set(self.ids.version, ui_widgets);
if self.show_disclaimer {
Image::new(self.imgs.disclaimer)
@ -314,12 +383,14 @@ impl MainMenuUi {
// Used when the login button is pressed, or enter is pressed within input field
macro_rules! login {
() => {
self.connect = true;
self.connecting = Some(std::time::Instant::now());
self.popup = Some(PopupData {
msg: "Connecting...".to_string(),
button_text: "Cancel".to_string(),
popup_type: PopupType::ConnectionInfo,
});
events.push(Event::LoginAttempt {
username: self.username.clone(),
password: self.password.clone(),
@ -350,9 +421,10 @@ impl MainMenuUi {
macro_rules! singleplayer {
() => {
events.push(Event::StartSingleplayer);
self.connect = true;
self.connecting = Some(std::time::Instant::now());
self.popup = Some(PopupData {
msg: "Connecting...".to_string(),
msg: "Creating World...".to_string(),
button_text: "Cancel".to_string(),
popup_type: PopupType::ConnectionInfo,
});
@ -419,45 +491,6 @@ impl MainMenuUi {
}
}
}*/
// Popup (Error/Info)
if let Some(popup_data) = &self.popup {
let text = Text::new(&popup_data.msg)
.rgba(1.0, 1.0, 1.0, 1.0)
.font_size(25)
.font_id(self.fonts.cyri);
Rectangle::fill_with([65.0 * 6.0, 140.0], color::TRANSPARENT)
.rgba(0.1, 0.1, 0.1, 1.0)
.parent(ui_widgets.window)
.up_from(self.ids.banner_top, 15.0)
.set(self.ids.login_error_bg, ui_widgets);
Image::new(self.imgs.info_frame)
.w_h(65.0 * 6.0, 140.0)
.middle_of(self.ids.login_error_bg)
.set(self.ids.error_frame, ui_widgets);
text.mid_top_with_margin_on(self.ids.error_frame, 10.0)
.set(self.ids.login_error, ui_widgets);
if Button::image(self.imgs.button)
.w_h(100.0, 30.0)
.mid_bottom_with_margin_on(self.ids.login_error_bg, 10.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label_y(Relative::Scalar(2.0))
.label(&popup_data.button_text)
.label_font_id(self.fonts.cyri)
.label_font_size(15)
.label_color(TEXT_COLOR)
.set(self.ids.button_ok, ui_widgets)
.was_clicked()
{
match popup_data.popup_type {
PopupType::ConnectionInfo => {
events.push(Event::CancelLoginAttempt);
}
_ => (),
};
self.popup = None;
};
}
if self.show_servers {
Image::new(self.imgs.info_frame)
.mid_top_with_margin_on(self.ids.username_bg, -320.0)
@ -646,6 +679,7 @@ impl MainMenuUi {
self.show_servers = !self.show_servers;
};
}
}
events
}
@ -657,24 +691,27 @@ impl MainMenuUi {
popup_type: PopupType::Error,
});
self.connecting = None;
self.connect = false;
}
pub fn connected(&mut self) {
self.popup = None;
self.connecting = None;
self.connect = false;
}
pub fn cancel_connection(&mut self) {
self.popup = None;
self.connecting = None;
self.connect = false;
}
pub fn handle_event(&mut self, event: ui::Event) {
self.ui.handle_event(event);
}
pub fn maintain(&mut self, global_state: &mut GlobalState) -> Vec<Event> {
let events = self.update_layout(global_state);
pub fn maintain(&mut self, global_state: &mut GlobalState, dt: Duration) -> Vec<Event> {
let events = self.update_layout(global_state, dt);
self.ui.maintain(global_state.window.renderer_mut(), None);
events
}