mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix: Player can't push the "Enter World" button anymore without having a character.
This commit is contained in:
@ -19,7 +19,6 @@ use conrod_core::{
|
|||||||
widget::{text_box::Event as TextBoxEvent, Button, Image, Rectangle, Scrollbar, Text, TextBox},
|
widget::{text_box::Event as TextBoxEvent, Button, Image, Rectangle, Scrollbar, Text, TextBox},
|
||||||
widget_ids, Borderable, Color, Colorable, Labelable, Positionable, Sizeable, UiCell, Widget,
|
widget_ids, Borderable, Color, Colorable, Labelable, Positionable, Sizeable, UiCell, Widget,
|
||||||
};
|
};
|
||||||
|
|
||||||
const STARTER_HAMMER: &str = "common.items.weapons.starter_hammer";
|
const STARTER_HAMMER: &str = "common.items.weapons.starter_hammer";
|
||||||
const STARTER_BOW: &str = "common.items.weapons.starter_bow";
|
const STARTER_BOW: &str = "common.items.weapons.starter_bow";
|
||||||
const STARTER_AXE: &str = "common.items.weapons.starter_axe";
|
const STARTER_AXE: &str = "common.items.weapons.starter_axe";
|
||||||
@ -478,20 +477,35 @@ impl CharSelectionUi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enter World Button
|
// Enter World Button
|
||||||
if Button::image(self.imgs.button)
|
let character_count = global_state.meta.characters.len();
|
||||||
.mid_bottom_with_margin_on(ui_widgets.window, 10.0)
|
if character_count != 0 {
|
||||||
.w_h(250.0, 60.0)
|
if Button::image(self.imgs.button)
|
||||||
.hover_image(self.imgs.button_hover)
|
.mid_bottom_with_margin_on(ui_widgets.window, 10.0)
|
||||||
.press_image(self.imgs.button_press)
|
.w_h(250.0, 60.0)
|
||||||
.label(&localized_strings.get("char_selection.enter_world"))
|
.hover_image(self.imgs.button_hover)
|
||||||
.label_color(TEXT_COLOR)
|
.press_image(self.imgs.button_press)
|
||||||
.label_font_size(26)
|
.label(&localized_strings.get("char_selection.enter_world"))
|
||||||
.label_font_id(self.fonts.cyri)
|
.label_color(TEXT_COLOR)
|
||||||
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
.label_font_size(26)
|
||||||
.set(self.ids.enter_world_button, ui_widgets)
|
.label_font_id(self.fonts.cyri)
|
||||||
.was_clicked()
|
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
||||||
{
|
.set(self.ids.enter_world_button, ui_widgets)
|
||||||
events.push(Event::Play);
|
.was_clicked()
|
||||||
|
{
|
||||||
|
events.push(Event::Play);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if Button::image(self.imgs.button)
|
||||||
|
.mid_bottom_with_margin_on(ui_widgets.window, 10.0)
|
||||||
|
.w_h(250.0, 60.0)
|
||||||
|
.label(&localized_strings.get("char_selection.enter_world"))
|
||||||
|
.label_color(TEXT_COLOR_2)
|
||||||
|
.label_font_size(26)
|
||||||
|
.label_font_id(self.fonts.cyri)
|
||||||
|
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
||||||
|
.set(self.ids.enter_world_button, ui_widgets)
|
||||||
|
.was_clicked()
|
||||||
|
{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logout_Button
|
// Logout_Button
|
||||||
@ -511,24 +525,6 @@ impl CharSelectionUi {
|
|||||||
events.push(Event::Logout);
|
events.push(Event::Logout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Character Button.
|
|
||||||
/*if Button::image(self.imgs.button)
|
|
||||||
.mid_bottom_with_margin_on(self.ids.charlist_bg, -60.0)
|
|
||||||
.w_h(270.0, 50.0)
|
|
||||||
.hover_image(self.imgs.button_hover)
|
|
||||||
.press_image(self.imgs.button_press)
|
|
||||||
.label("Create Character")
|
|
||||||
.label_font_id(self.fonts.cyri)
|
|
||||||
.label_color(TEXT_COLOR)
|
|
||||||
.label_font_size(20)
|
|
||||||
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
|
||||||
.set(self.ids.create_character_button, ui_widgets)
|
|
||||||
.was_clicked()
|
|
||||||
{
|
|
||||||
self.character_creation = true;
|
|
||||||
self.character_tool = Some(STARTER_SWORD);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Alpha Version
|
// Alpha Version
|
||||||
Text::new(&version)
|
Text::new(&version)
|
||||||
.top_right_with_margins_on(ui_widgets.window, 5.0, 5.0)
|
.top_right_with_margins_on(ui_widgets.window, 5.0, 5.0)
|
||||||
@ -538,7 +534,6 @@ impl CharSelectionUi {
|
|||||||
.set(self.ids.version, ui_widgets);
|
.set(self.ids.version, ui_widgets);
|
||||||
|
|
||||||
// Resize character selection widgets
|
// Resize character selection widgets
|
||||||
let character_count = global_state.meta.characters.len();
|
|
||||||
self.ids
|
self.ids
|
||||||
.character_boxes
|
.character_boxes
|
||||||
.resize(character_count, &mut ui_widgets.widget_id_generator());
|
.resize(character_count, &mut ui_widgets.widget_id_generator());
|
||||||
@ -634,7 +629,6 @@ impl CharSelectionUi {
|
|||||||
2.0,
|
2.0,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
if create_char_button
|
if create_char_button
|
||||||
.w_h(386.0, 80.0)
|
.w_h(386.0, 80.0)
|
||||||
.hover_image(self.imgs.selection_hover)
|
.hover_image(self.imgs.selection_hover)
|
||||||
@ -1136,11 +1130,6 @@ impl CharSelectionUi {
|
|||||||
{
|
{
|
||||||
*tool = Some(STARTER_AXE);
|
*tool = Some(STARTER_AXE);
|
||||||
}
|
}
|
||||||
// REMOVE THIS AFTER IMPLEMENTATION
|
|
||||||
/*Rectangle::fill_with([67.0, 67.0], color::rgba(0.0, 0.0, 0.0, 0.8))
|
|
||||||
.middle_of(self.ids.axe)
|
|
||||||
.set(self.ids.axe_grey, ui_widgets);*/
|
|
||||||
|
|
||||||
// Sliders
|
// Sliders
|
||||||
let (metamorph, slider_indicator, slider_range) = (
|
let (metamorph, slider_indicator, slider_range) = (
|
||||||
self.fonts.cyri,
|
self.fonts.cyri,
|
||||||
|
Reference in New Issue
Block a user