mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
help window, chat padding, font colours
Former-commit-id: 8d42f8e05cd11f669e4e56873e31a8530272b3b2
This commit is contained in:
parent
a45e9e708c
commit
bc420e41d6
@ -3,7 +3,7 @@ use conrod_core::{
|
||||
input::Key,
|
||||
position::Dimension,
|
||||
text::font::Id as FontId,
|
||||
widget::{Id, Button, List, Rectangle, Text, TextEdit},
|
||||
widget::{Button, Id, List, Rectangle, Text, TextEdit},
|
||||
widget_ids, Color, Colorable, Positionable, Sizeable, UiCell, Widget,
|
||||
};
|
||||
use std::collections::VecDeque;
|
||||
@ -70,7 +70,12 @@ impl Chat {
|
||||
fn scroll_to_bottom(&self, ui_widgets: &mut UiCell) {
|
||||
ui_widgets.scroll_widget(self.ids.message_box, [0.0, std::f64::MAX]);
|
||||
}
|
||||
pub(super) fn update_layout(&mut self, ui_widgets: &mut UiCell, font: FontId, imgs: &super::Imgs) -> Option<String> {
|
||||
pub(super) fn update_layout(
|
||||
&mut self,
|
||||
ui_widgets: &mut UiCell,
|
||||
font: FontId,
|
||||
imgs: &super::Imgs,
|
||||
) -> Option<String> {
|
||||
// Maintain scrolling
|
||||
if self.new_messages {
|
||||
self.scroll_new_messages(ui_widgets);
|
||||
@ -81,7 +86,7 @@ impl Chat {
|
||||
let text_edit = TextEdit::new(&self.input)
|
||||
.w(470.0)
|
||||
.restrict_to_height(false)
|
||||
.font_size(14)
|
||||
.font_size(15)
|
||||
.font_id(font)
|
||||
.bottom_left_with_margins_on(ui_widgets.window, 10.0, 10.0);
|
||||
let dims = match (
|
||||
@ -102,12 +107,13 @@ impl Chat {
|
||||
}
|
||||
|
||||
// Message box
|
||||
Rectangle::fill([470.0, 180.0])
|
||||
Rectangle::fill([470.0, 160.0])
|
||||
.rgba(0.0, 0.0, 0.0, 0.4)
|
||||
.up_from(self.ids.input, 0.0)
|
||||
.set(self.ids.message_box_bg, ui_widgets);
|
||||
let (mut items, scrollbar) = List::flow_down(self.messages.len())
|
||||
.middle_of(self.ids.message_box_bg)
|
||||
.top_left_with_margins_on(self.ids.message_box_bg, 0.0, 5.0)
|
||||
.w_h(460.0, 160.0)
|
||||
.scrollbar_next_to()
|
||||
.scrollbar_thickness(18.0)
|
||||
.scrollbar_color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
|
||||
@ -115,9 +121,9 @@ impl Chat {
|
||||
while let Some(item) = items.next(ui_widgets) {
|
||||
item.set(
|
||||
Text::new(&self.messages[item.i])
|
||||
.font_size(14)
|
||||
.font_size(15)
|
||||
.font_id(font)
|
||||
.rgba(0.86 , 0.86, 0.86, 1.0),
|
||||
.rgba(1.0, 1.0, 1.0, 1.0),
|
||||
ui_widgets,
|
||||
)
|
||||
}
|
||||
|
@ -7,11 +7,11 @@ use crate::{
|
||||
};
|
||||
use common::assets;
|
||||
use conrod_core::{
|
||||
color, Color,
|
||||
color,
|
||||
image::Id as ImgId,
|
||||
text::font::Id as FontId,
|
||||
widget::{Button, Image, Rectangle, Scrollbar, Text},
|
||||
widget_ids, Colorable, Labelable, Positionable, Sizeable, Widget,
|
||||
widget_ids, Color, Colorable, Labelable, Positionable, Sizeable, Widget,
|
||||
};
|
||||
|
||||
widget_ids! {
|
||||
@ -459,7 +459,7 @@ impl Hud {
|
||||
typing: false,
|
||||
cursor_grabbed: true,
|
||||
settings_tab: SettingsTab::Interface,
|
||||
show_help: false,
|
||||
show_help: true,
|
||||
bag_open: false,
|
||||
menu_open: false,
|
||||
map_open: false,
|
||||
@ -479,12 +479,11 @@ impl Hud {
|
||||
let mut events = Vec::new();
|
||||
let ref mut ui_widgets = self.ui.set_widgets();
|
||||
|
||||
const TEXT_COLOR: Color = Color::Rgba(0.86, 0.86, 0.86, 0.8);
|
||||
const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0);
|
||||
const HP_COLOR: Color = Color::Rgba(0.33, 0.63, 0.0, 1.0);
|
||||
const MANA_COLOR: Color = Color::Rgba(0.42, 0.41, 0.66, 1.0);
|
||||
const XP_COLOR: Color = Color::Rgba(0.59, 0.41, 0.67, 1.0);
|
||||
|
||||
|
||||
if self.show_ui {
|
||||
// Add Bag-Space Button
|
||||
if self.inventorytest_button {
|
||||
@ -512,7 +511,7 @@ impl Hud {
|
||||
if self.show_help {
|
||||
Image::new(self.imgs.window_frame_2)
|
||||
.top_left_with_margins_on(ui_widgets.window, 5.0, 5.0)
|
||||
.w_h(300.0, 300.0)
|
||||
.w_h(300.0, 370.0)
|
||||
.set(self.ids.help_bg, ui_widgets);
|
||||
|
||||
Text::new(
|
||||
@ -523,6 +522,9 @@ impl Hud {
|
||||
F1 = Toggle this Window \n\
|
||||
F2 = Toggle Interface \n\
|
||||
\n\
|
||||
Enter = Open Chat \n\
|
||||
Mouse Wheel = Scroll Chat\n\
|
||||
\n\
|
||||
M = Map \n\
|
||||
B = Bag \n\
|
||||
L = Quest-Log \n\
|
||||
@ -753,7 +755,6 @@ impl Hud {
|
||||
.top_right_with_margins_on(self.ids.health_bar, 5.0, 0.0)
|
||||
.set(self.ids.health_bar_color, ui_widgets);
|
||||
|
||||
|
||||
// Mana Bar
|
||||
Image::new(self.imgs.mana_bar)
|
||||
.w_h(1120.0 / 6.0, 96.0 / 6.0)
|
||||
@ -766,7 +767,6 @@ impl Hud {
|
||||
.top_left_with_margins_on(self.ids.mana_bar, 5.0, 0.0)
|
||||
.set(self.ids.mana_bar_color, ui_widgets);
|
||||
|
||||
|
||||
// Buffs/Debuffs
|
||||
|
||||
// Buffs
|
||||
@ -778,14 +778,14 @@ impl Hud {
|
||||
// Insert actual Level here
|
||||
Text::new("1")
|
||||
.left_from(self.ids.xp_bar, -15.0)
|
||||
.font_size(14)
|
||||
.font_size(10)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.level_text, ui_widgets);
|
||||
|
||||
// Insert next Level here
|
||||
Text::new("2")
|
||||
.right_from(self.ids.xp_bar, -15.0)
|
||||
.font_size(14)
|
||||
.font_size(10)
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.next_level_text, ui_widgets);
|
||||
|
||||
|
@ -345,7 +345,7 @@ pub enum Event {
|
||||
Play,
|
||||
}
|
||||
|
||||
const TEXT_COLOR: Color = Color::Rgba(0.86, 0.86, 0.86, 0.8);
|
||||
const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
pub struct CharSelectionUi {
|
||||
ui: Ui,
|
||||
@ -495,7 +495,6 @@ impl CharSelectionUi {
|
||||
.color(TEXT_COLOR)
|
||||
.set(self.ids.char_level, ui_widgets);
|
||||
|
||||
|
||||
// Selected Character
|
||||
if no == 1 {
|
||||
Image::new(self.imgs.test_char_l_big)
|
||||
|
@ -6,10 +6,7 @@ use crate::{
|
||||
GlobalState, PlayState, PlayStateResult,
|
||||
};
|
||||
use client::{self, Client};
|
||||
use common::{
|
||||
comp,
|
||||
clock::Clock,
|
||||
};
|
||||
use common::clock::Clock;
|
||||
use std::time::Duration;
|
||||
use ui::{Event as MainMenuEvent, MainMenuUi};
|
||||
use vek::*;
|
||||
@ -70,12 +67,12 @@ impl PlayState for MainMenuState {
|
||||
Ok(mut socket_adders) => {
|
||||
while let Some(socket_addr) = socket_adders.next() {
|
||||
// TODO: handle error
|
||||
match Client::new(socket_addr, comp::Player::new(username.clone()), Some(comp::Character::test())) {
|
||||
match Client::new(socket_addr) {
|
||||
Ok(client) => {
|
||||
return PlayStateResult::Push(
|
||||
Box::new(CharSelectionState::new(
|
||||
&mut global_state.window,
|
||||
std::rc::Rc::new(std::cell::RefCell::new(client)) // <--- TODO: Remove this
|
||||
std::rc::Rc::new(std::cell::RefCell::new(client.with_test_state())) // <--- TODO: Remove this
|
||||
))
|
||||
);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ impl MainMenuUi {
|
||||
});
|
||||
};
|
||||
}
|
||||
const TEXT_COLOR: Color = Color::Rgba(0.94, 0.94, 0.94, 0.8);
|
||||
const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0);
|
||||
// Username
|
||||
// TODO: get a lower resolution and cleaner input_bg.png
|
||||
Image::new(self.imgs.input_bg)
|
||||
@ -249,7 +249,7 @@ impl MainMenuUi {
|
||||
.align_middle_x_of(self.ids.address_bg)
|
||||
.label("Login")
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(28)
|
||||
.label_font_size(26)
|
||||
.label_y(conrod_core::position::Relative::Scalar(5.0))
|
||||
.set(self.ids.login_button, ui_widgets)
|
||||
.was_clicked()
|
||||
|
Loading…
Reference in New Issue
Block a user