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,
|
input::Key,
|
||||||
position::Dimension,
|
position::Dimension,
|
||||||
text::font::Id as FontId,
|
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,
|
widget_ids, Color, Colorable, Positionable, Sizeable, UiCell, Widget,
|
||||||
};
|
};
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
@ -70,12 +70,7 @@ impl Chat {
|
|||||||
fn scroll_to_bottom(&self, ui_widgets: &mut UiCell) {
|
fn scroll_to_bottom(&self, ui_widgets: &mut UiCell) {
|
||||||
ui_widgets.scroll_widget(self.ids.message_box, [0.0, std::f64::MAX]);
|
ui_widgets.scroll_widget(self.ids.message_box, [0.0, std::f64::MAX]);
|
||||||
}
|
}
|
||||||
pub(super) fn update_layout(
|
pub(super) fn update_layout(&mut self, ui_widgets: &mut UiCell, font: FontId, imgs: &super::Imgs) -> Option<String> {
|
||||||
&mut self,
|
|
||||||
ui_widgets: &mut UiCell,
|
|
||||||
font: FontId,
|
|
||||||
imgs: &super::Imgs,
|
|
||||||
) -> Option<String> {
|
|
||||||
// Maintain scrolling
|
// Maintain scrolling
|
||||||
if self.new_messages {
|
if self.new_messages {
|
||||||
self.scroll_new_messages(ui_widgets);
|
self.scroll_new_messages(ui_widgets);
|
||||||
@ -107,13 +102,12 @@ impl Chat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Message box
|
// Message box
|
||||||
Rectangle::fill([470.0, 160.0])
|
Rectangle::fill([470.0, 180.0])
|
||||||
.rgba(0.0, 0.0, 0.0, 0.4)
|
.rgba(0.0, 0.0, 0.0, 0.4)
|
||||||
.up_from(self.ids.input, 0.0)
|
.up_from(self.ids.input, 0.0)
|
||||||
.set(self.ids.message_box_bg, ui_widgets);
|
.set(self.ids.message_box_bg, ui_widgets);
|
||||||
let (mut items, scrollbar) = List::flow_down(self.messages.len())
|
let (mut items, scrollbar) = List::flow_down(self.messages.len())
|
||||||
.top_left_with_margins_on(self.ids.message_box_bg, 0.0, 5.0)
|
.middle_of(self.ids.message_box_bg)
|
||||||
.w_h(460.0, 160.0)
|
|
||||||
.scrollbar_next_to()
|
.scrollbar_next_to()
|
||||||
.scrollbar_thickness(18.0)
|
.scrollbar_thickness(18.0)
|
||||||
.scrollbar_color(Color::Rgba(0.0, 0.0, 0.0, 1.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])
|
Text::new(&self.messages[item.i])
|
||||||
.font_size(14)
|
.font_size(14)
|
||||||
.font_id(font)
|
.font_id(font)
|
||||||
.rgba(1.0, 1.0, 1.0, 1.0),
|
.rgba(0.86 , 0.86, 0.86, 1.0),
|
||||||
ui_widgets,
|
ui_widgets,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -131,12 +125,12 @@ impl Chat {
|
|||||||
// Chat Arrow
|
// Chat Arrow
|
||||||
if !self.scrolled_to_bottom(ui_widgets) {
|
if !self.scrolled_to_bottom(ui_widgets) {
|
||||||
if Button::image(imgs.chat_arrow)
|
if Button::image(imgs.chat_arrow)
|
||||||
.w_h(22.0, 22.0)
|
.w_h(22.0, 22.0)
|
||||||
.hover_image(imgs.chat_arrow_mo)
|
.hover_image(imgs.chat_arrow_mo)
|
||||||
.press_image(imgs.chat_arrow_press)
|
.press_image(imgs.chat_arrow_press)
|
||||||
.bottom_right_with_margins_on(self.ids.message_box_bg, 2.0, 2.0)
|
.bottom_right_with_margins_on(self.ids.message_box_bg, 2.0, 2.0)
|
||||||
.set(self.ids.chat_arrow, ui_widgets)
|
.set(self.ids.chat_arrow, ui_widgets)
|
||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
self.scroll_to_bottom(ui_widgets);
|
self.scroll_to_bottom(ui_widgets);
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,11 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use common::assets;
|
use common::assets;
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
color,
|
color, Color,
|
||||||
image::Id as ImgId,
|
image::Id as ImgId,
|
||||||
text::font::Id as FontId,
|
text::font::Id as FontId,
|
||||||
widget::{Button, Image, Rectangle, Scrollbar, Text},
|
widget::{Button, Image, Rectangle, Scrollbar, Text},
|
||||||
widget_ids, Color, Colorable, Labelable, Positionable, Sizeable, Widget,
|
widget_ids, Colorable, Labelable, Positionable, Sizeable, Widget,
|
||||||
};
|
};
|
||||||
|
|
||||||
widget_ids! {
|
widget_ids! {
|
||||||
@ -422,7 +422,7 @@ pub struct Hud {
|
|||||||
|
|
||||||
//#[inline]
|
//#[inline]
|
||||||
//pub fn rgba_bytes(r: u8, g: u8, b: u8, a: f32) -> Color {
|
//pub fn rgba_bytes(r: u8, g: u8, b: u8, a: f32) -> Color {
|
||||||
//Color::Rgba(r as f32 / 255.0, g as f32 / 255.0, b as f32 / 255.0, a)
|
//Color::Rgba(r as f32 / 255.0, g as f32 / 255.0, b as f32 / 255.0, a)
|
||||||
//}
|
//}
|
||||||
|
|
||||||
impl Hud {
|
impl Hud {
|
||||||
@ -459,7 +459,7 @@ impl Hud {
|
|||||||
typing: false,
|
typing: false,
|
||||||
cursor_grabbed: true,
|
cursor_grabbed: true,
|
||||||
settings_tab: SettingsTab::Interface,
|
settings_tab: SettingsTab::Interface,
|
||||||
show_help: true,
|
show_help: false,
|
||||||
bag_open: false,
|
bag_open: false,
|
||||||
menu_open: false,
|
menu_open: false,
|
||||||
map_open: false,
|
map_open: false,
|
||||||
@ -479,11 +479,12 @@ impl Hud {
|
|||||||
let mut events = Vec::new();
|
let mut events = Vec::new();
|
||||||
let ref mut ui_widgets = self.ui.set_widgets();
|
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 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 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);
|
const XP_COLOR: Color = Color::Rgba(0.59, 0.41, 0.67, 1.0);
|
||||||
|
|
||||||
|
|
||||||
if self.show_ui {
|
if self.show_ui {
|
||||||
// Add Bag-Space Button
|
// Add Bag-Space Button
|
||||||
if self.inventorytest_button {
|
if self.inventorytest_button {
|
||||||
@ -511,7 +512,7 @@ impl Hud {
|
|||||||
if self.show_help {
|
if self.show_help {
|
||||||
Image::new(self.imgs.window_frame_2)
|
Image::new(self.imgs.window_frame_2)
|
||||||
.top_left_with_margins_on(ui_widgets.window, 5.0, 5.0)
|
.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);
|
.set(self.ids.help_bg, ui_widgets);
|
||||||
|
|
||||||
Text::new(
|
Text::new(
|
||||||
@ -522,9 +523,6 @@ impl Hud {
|
|||||||
F1 = Toggle this Window \n\
|
F1 = Toggle this Window \n\
|
||||||
F2 = Toggle Interface \n\
|
F2 = Toggle Interface \n\
|
||||||
\n\
|
\n\
|
||||||
Enter = Open Chat \n\
|
|
||||||
Mouse Wheel= Scroll Chat\n\
|
|
||||||
\n\
|
|
||||||
M = Map \n\
|
M = Map \n\
|
||||||
B = Bag \n\
|
B = Bag \n\
|
||||||
L = Quest-Log \n\
|
L = Quest-Log \n\
|
||||||
@ -755,6 +753,7 @@ impl Hud {
|
|||||||
.top_right_with_margins_on(self.ids.health_bar, 5.0, 0.0)
|
.top_right_with_margins_on(self.ids.health_bar, 5.0, 0.0)
|
||||||
.set(self.ids.health_bar_color, ui_widgets);
|
.set(self.ids.health_bar_color, ui_widgets);
|
||||||
|
|
||||||
|
|
||||||
// Mana Bar
|
// Mana Bar
|
||||||
Image::new(self.imgs.mana_bar)
|
Image::new(self.imgs.mana_bar)
|
||||||
.w_h(1120.0 / 6.0, 96.0 / 6.0)
|
.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)
|
.top_left_with_margins_on(self.ids.mana_bar, 5.0, 0.0)
|
||||||
.set(self.ids.mana_bar_color, ui_widgets);
|
.set(self.ids.mana_bar_color, ui_widgets);
|
||||||
|
|
||||||
|
|
||||||
// Buffs/Debuffs
|
// Buffs/Debuffs
|
||||||
|
|
||||||
// Buffs
|
// Buffs
|
||||||
@ -778,14 +778,14 @@ impl Hud {
|
|||||||
// Insert actual Level here
|
// Insert actual Level here
|
||||||
Text::new("1")
|
Text::new("1")
|
||||||
.left_from(self.ids.xp_bar, -15.0)
|
.left_from(self.ids.xp_bar, -15.0)
|
||||||
.font_size(10)
|
.font_size(14)
|
||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
.set(self.ids.level_text, ui_widgets);
|
.set(self.ids.level_text, ui_widgets);
|
||||||
|
|
||||||
// Insert next Level here
|
// Insert next Level here
|
||||||
Text::new("2")
|
Text::new("2")
|
||||||
.right_from(self.ids.xp_bar, -15.0)
|
.right_from(self.ids.xp_bar, -15.0)
|
||||||
.font_size(10)
|
.font_size(14)
|
||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
.set(self.ids.next_level_text, ui_widgets);
|
.set(self.ids.next_level_text, ui_widgets);
|
||||||
|
|
||||||
@ -1561,39 +1561,39 @@ impl Hud {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
WinEvent::KeyDown(key) if !self.typing => match key {
|
WinEvent::KeyDown(key) if !self.typing => match key {
|
||||||
Key::Map => {
|
Key::Map => {
|
||||||
self.toggle_map();
|
self.toggle_map();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Key::Bag => {
|
Key::Bag => {
|
||||||
self.toggle_bag();
|
self.toggle_bag();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Key::QuestLog => {
|
Key::QuestLog => {
|
||||||
self.toggle_questlog();
|
self.toggle_questlog();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Key::CharacterWindow => {
|
Key::CharacterWindow => {
|
||||||
self.toggle_charwindow();
|
self.toggle_charwindow();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Key::Social => {
|
Key::Social => {
|
||||||
self.toggle_social();
|
self.toggle_social();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Key::Spellbook => {
|
Key::Spellbook => {
|
||||||
self.toggle_spellbook();
|
self.toggle_spellbook();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Key::Settings => {
|
Key::Settings => {
|
||||||
self.toggle_settings();
|
self.toggle_settings();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Key::Help => {
|
Key::Help => {
|
||||||
self.toggle_help();
|
self.toggle_help();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Key::Interface => {
|
Key::Interface => {
|
||||||
self.toggle_ui();
|
self.toggle_ui();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ pub enum Event {
|
|||||||
Play,
|
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 {
|
pub struct CharSelectionUi {
|
||||||
ui: Ui,
|
ui: Ui,
|
||||||
@ -463,7 +463,7 @@ impl CharSelectionUi {
|
|||||||
.set(self.ids.test_char_l_button, ui_widgets)
|
.set(self.ids.test_char_l_button, ui_widgets)
|
||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
self.selected_char_no = Some(1);
|
self.selected_char_no = Some(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Veloren Logo and Alpha Version
|
// Veloren Logo and Alpha Version
|
||||||
@ -477,7 +477,7 @@ impl CharSelectionUi {
|
|||||||
.label_x(conrod_core::position::Relative::Scalar(-100.0))
|
.label_x(conrod_core::position::Relative::Scalar(-100.0))
|
||||||
.set(self.ids.v_logo, ui_widgets);
|
.set(self.ids.v_logo, ui_widgets);
|
||||||
|
|
||||||
if let Some(no) = self.selected_char_no {
|
if let Some(no) = self.selected_char_no {
|
||||||
// Selection_Window
|
// Selection_Window
|
||||||
Image::new(self.imgs.selection_window)
|
Image::new(self.imgs.selection_window)
|
||||||
.w_h(522.0, 722.0)
|
.w_h(522.0, 722.0)
|
||||||
@ -495,6 +495,7 @@ impl CharSelectionUi {
|
|||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
.set(self.ids.char_level, ui_widgets);
|
.set(self.ids.char_level, ui_widgets);
|
||||||
|
|
||||||
|
|
||||||
// Selected Character
|
// Selected Character
|
||||||
if no == 1 {
|
if no == 1 {
|
||||||
Image::new(self.imgs.test_char_l_big)
|
Image::new(self.imgs.test_char_l_big)
|
||||||
@ -871,11 +872,11 @@ impl CharSelectionUi {
|
|||||||
Their greatest strengths are their adaptability and intelligence, which makes them allrounders in many fields.";
|
Their greatest strengths are their adaptability and intelligence, which makes them allrounders in many fields.";
|
||||||
const ORC_DESC: &str =
|
const ORC_DESC: &str =
|
||||||
"They are considered brutal, rude and combative. \n\
|
"They are considered brutal, rude and combative. \n\
|
||||||
But once you gained their trust they will be loyal friends \n\
|
But once you gained their trust they will be loyal friends \n\
|
||||||
that follow a strict code of honor in all of their actions. \n\
|
that follow a strict code of honor in all of their actions. \n\
|
||||||
\n\
|
\n\
|
||||||
Their warriors are masters of melee combat, but their true power \
|
Their warriors are masters of melee combat, but their true power \
|
||||||
comes from the magical rituals of their powerful shamans.";
|
comes from the magical rituals of their powerful shamans.";
|
||||||
const DWARF_DESC: &str =
|
const DWARF_DESC: &str =
|
||||||
"Smoking chimneys, the sound of countless hammers and hoes. \
|
"Smoking chimneys, the sound of countless hammers and hoes. \
|
||||||
Infinite tunnel systems to track down even the last chunk of metal in the ground. \n\
|
Infinite tunnel systems to track down even the last chunk of metal in the ground. \n\
|
||||||
|
@ -6,7 +6,10 @@ use crate::{
|
|||||||
GlobalState, PlayState, PlayStateResult,
|
GlobalState, PlayState, PlayStateResult,
|
||||||
};
|
};
|
||||||
use client::{self, Client};
|
use client::{self, Client};
|
||||||
use common::clock::Clock;
|
use common::{
|
||||||
|
comp,
|
||||||
|
clock::Clock,
|
||||||
|
};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use ui::{Event as MainMenuEvent, MainMenuUi};
|
use ui::{Event as MainMenuEvent, MainMenuUi};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
@ -67,12 +70,12 @@ impl PlayState for MainMenuState {
|
|||||||
Ok(mut socket_adders) => {
|
Ok(mut socket_adders) => {
|
||||||
while let Some(socket_addr) = socket_adders.next() {
|
while let Some(socket_addr) = socket_adders.next() {
|
||||||
// TODO: handle error
|
// TODO: handle error
|
||||||
match Client::new(socket_addr) {
|
match Client::new(socket_addr, comp::Player::new(username.clone()), Some(comp::Character::test())) {
|
||||||
Ok(client) => {
|
Ok(client) => {
|
||||||
return PlayStateResult::Push(
|
return PlayStateResult::Push(
|
||||||
Box::new(CharSelectionState::new(
|
Box::new(CharSelectionState::new(
|
||||||
&mut global_state.window,
|
&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
|
// Username
|
||||||
// TODO: get a lower resolution and cleaner input_bg.png
|
// TODO: get a lower resolution and cleaner input_bg.png
|
||||||
Image::new(self.imgs.input_bg)
|
Image::new(self.imgs.input_bg)
|
||||||
@ -249,7 +249,7 @@ impl MainMenuUi {
|
|||||||
.align_middle_x_of(self.ids.address_bg)
|
.align_middle_x_of(self.ids.address_bg)
|
||||||
.label("Login")
|
.label("Login")
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
.label_font_size(26)
|
.label_font_size(28)
|
||||||
.label_y(conrod_core::position::Relative::Scalar(5.0))
|
.label_y(conrod_core::position::Relative::Scalar(5.0))
|
||||||
.set(self.ids.login_button, ui_widgets)
|
.set(self.ids.login_button, ui_widgets)
|
||||||
.was_clicked()
|
.was_clicked()
|
||||||
|
Loading…
Reference in New Issue
Block a user