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: 18643504fd8e94ed991c137e9ea91dfa094686c7
This commit is contained in:
parent
822901b08b
commit
a45e9e708c
@ -3,7 +3,7 @@ use conrod_core::{
|
||||
input::Key,
|
||||
position::Dimension,
|
||||
text::font::Id as FontId,
|
||||
widget::{Button, Id, List, Rectangle, Text, TextEdit},
|
||||
widget::{Id, Button, List, Rectangle, Text, TextEdit},
|
||||
widget_ids, Color, Colorable, Positionable, Sizeable, UiCell, Widget,
|
||||
};
|
||||
use std::collections::VecDeque;
|
||||
@ -70,12 +70,7 @@ 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);
|
||||
@ -107,13 +102,12 @@ impl Chat {
|
||||
}
|
||||
|
||||
// Message box
|
||||
Rectangle::fill([470.0, 160.0])
|
||||
Rectangle::fill([470.0, 180.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())
|
||||
.top_left_with_margins_on(self.ids.message_box_bg, 0.0, 5.0)
|
||||
.w_h(460.0, 160.0)
|
||||
.middle_of(self.ids.message_box_bg)
|
||||
.scrollbar_next_to()
|
||||
.scrollbar_thickness(18.0)
|
||||
.scrollbar_color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
|
||||
@ -123,7 +117,7 @@ impl Chat {
|
||||
Text::new(&self.messages[item.i])
|
||||
.font_size(14)
|
||||
.font_id(font)
|
||||
.rgba(1.0, 1.0, 1.0, 1.0),
|
||||
.rgba(0.86 , 0.86, 0.86, 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, Color, Colorable, Labelable, Positionable, Sizeable, Widget,
|
||||
widget_ids, Colorable, Labelable, Positionable, Sizeable, Widget,
|
||||
};
|
||||
|
||||
widget_ids! {
|
||||
@ -459,7 +459,7 @@ impl Hud {
|
||||
typing: false,
|
||||
cursor_grabbed: true,
|
||||
settings_tab: SettingsTab::Interface,
|
||||
show_help: true,
|
||||
show_help: false,
|
||||
bag_open: false,
|
||||
menu_open: false,
|
||||
map_open: false,
|
||||
@ -479,11 +479,12 @@ impl Hud {
|
||||
let mut events = Vec::new();
|
||||
let ref mut ui_widgets = self.ui.set_widgets();
|
||||
|
||||
const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0);
|
||||
const TEXT_COLOR: Color = Color::Rgba(0.86, 0.86, 0.86, 0.8);
|
||||
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 {
|
||||
@ -511,7 +512,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, 370.0)
|
||||
.w_h(300.0, 300.0)
|
||||
.set(self.ids.help_bg, ui_widgets);
|
||||
|
||||
Text::new(
|
||||
@ -522,9 +523,6 @@ 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\
|
||||
@ -755,6 +753,7 @@ 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)
|
||||
@ -767,6 +766,7 @@ 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(10)
|
||||
.font_size(14)
|
||||
.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(10)
|
||||
.font_size(14)
|
||||
.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(1.0, 1.0, 1.0, 1.0);
|
||||
const TEXT_COLOR: Color = Color::Rgba(0.86, 0.86, 0.86, 0.8);
|
||||
|
||||
pub struct CharSelectionUi {
|
||||
ui: Ui,
|
||||
@ -495,6 +495,7 @@ 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,7 +6,10 @@ use crate::{
|
||||
GlobalState, PlayState, PlayStateResult,
|
||||
};
|
||||
use client::{self, Client};
|
||||
use common::clock::Clock;
|
||||
use common::{
|
||||
comp,
|
||||
clock::Clock,
|
||||
};
|
||||
use std::time::Duration;
|
||||
use ui::{Event as MainMenuEvent, MainMenuUi};
|
||||
use vek::*;
|
||||
@ -67,12 +70,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) {
|
||||
match Client::new(socket_addr, comp::Player::new(username.clone()), Some(comp::Character::test())) {
|
||||
Ok(client) => {
|
||||
return PlayStateResult::Push(
|
||||
Box::new(CharSelectionState::new(
|
||||
&mut global_state.window,
|
||||
std::rc::Rc::new(std::cell::RefCell::new(client.with_test_state())) // <--- TODO: Remove this
|
||||
std::rc::Rc::new(std::cell::RefCell::new(client)) // <--- TODO: Remove this
|
||||
))
|
||||
);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ impl MainMenuUi {
|
||||
});
|
||||
};
|
||||
}
|
||||
const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0);
|
||||
const TEXT_COLOR: Color = Color::Rgba(0.94, 0.94, 0.94, 0.8);
|
||||
// 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(26)
|
||||
.label_font_size(28)
|
||||
.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