mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Character stats displayed in char window, pulsating active slot in inventory
This commit is contained in:
parent
b8135408a5
commit
bfee0a6f9e
@ -65,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Made clouds bigger, more performant and prettier
|
- Made clouds bigger, more performant and prettier
|
||||||
- Terrain meshing optimized further
|
- Terrain meshing optimized further
|
||||||
- Tree leaves no longer color blended
|
- Tree leaves no longer color blended
|
||||||
|
- Actual character stats displayed in character window
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -317,13 +317,12 @@ Chat commands:
|
|||||||
/// Start character window section
|
/// Start character window section
|
||||||
"character_window.character_name": "Character Name",
|
"character_window.character_name": "Character Name",
|
||||||
// Charater stats
|
// Charater stats
|
||||||
"character_window.character_stats": r#"Stamina
|
"character_window.character_stats": r#"Endurance
|
||||||
|
|
||||||
Strength
|
Fitness
|
||||||
|
|
||||||
Dexterity
|
Willpower
|
||||||
|
"#,
|
||||||
Intelligence"#,
|
|
||||||
|
|
||||||
|
|
||||||
/// Start character window section
|
/// Start character window section
|
||||||
|
@ -40,6 +40,7 @@ pub struct Bag<'a> {
|
|||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
|
pulse: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Bag<'a> {
|
impl<'a> Bag<'a> {
|
||||||
@ -50,6 +51,7 @@ impl<'a> Bag<'a> {
|
|||||||
fonts: &'a Fonts,
|
fonts: &'a Fonts,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
|
pulse: f32,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
client,
|
client,
|
||||||
@ -59,6 +61,7 @@ impl<'a> Bag<'a> {
|
|||||||
common: widget::CommonBuilder::default(),
|
common: widget::CommonBuilder::default(),
|
||||||
rot_imgs,
|
rot_imgs,
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
|
pulse,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,6 +106,7 @@ impl<'a> Widget for Bag<'a> {
|
|||||||
Some(inv) => inv,
|
Some(inv) => inv,
|
||||||
None => return None,
|
None => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tooltips
|
// Tooltips
|
||||||
let item_tooltip = Tooltip::new({
|
let item_tooltip = Tooltip::new({
|
||||||
// Edge images [t, b, r, l]
|
// Edge images [t, b, r, l]
|
||||||
@ -173,6 +177,7 @@ impl<'a> Widget for Bag<'a> {
|
|||||||
let is_selected = Some(i) == state.selected_slot;
|
let is_selected = Some(i) == state.selected_slot;
|
||||||
|
|
||||||
// Slot
|
// Slot
|
||||||
|
|
||||||
let slot_widget = Button::image(if !is_selected {
|
let slot_widget = Button::image(if !is_selected {
|
||||||
self.imgs.inv_slot
|
self.imgs.inv_slot
|
||||||
} else {
|
} else {
|
||||||
@ -182,9 +187,8 @@ impl<'a> Widget for Bag<'a> {
|
|||||||
state.ids.inv_alignment,
|
state.ids.inv_alignment,
|
||||||
0.0 + y as f64 * (40.0 + 2.0),
|
0.0 + y as f64 * (40.0 + 2.0),
|
||||||
0.0 + x as f64 * (40.0 + 2.0),
|
0.0 + x as f64 * (40.0 + 2.0),
|
||||||
) // conrod uses a (y,x) format for placing...
|
)
|
||||||
// (the margin placement functions do this because that is the same order as "top left")
|
.wh(if is_selected { [40.0; 2] } else { [40.0; 2] })
|
||||||
.w_h(40.0, 40.0)
|
|
||||||
.image_color(if is_selected {
|
.image_color(if is_selected {
|
||||||
color::WHITE
|
color::WHITE
|
||||||
} else {
|
} else {
|
||||||
@ -223,6 +227,9 @@ impl<'a> Widget for Bag<'a> {
|
|||||||
}
|
}
|
||||||
// Item
|
// Item
|
||||||
if let Some(kind) = item.as_ref().map(|i| ItemKey::from(i)) {
|
if let Some(kind) = item.as_ref().map(|i| ItemKey::from(i)) {
|
||||||
|
let slot_anim: f64 =
|
||||||
|
((self.pulse as f64 * 4.0/*speed factor*/).cos() * 0.5 + 0.5) * 2.0; //Animation timer
|
||||||
|
println!("{}", slot_anim);
|
||||||
Button::image(match &state.img_id_cache[i] {
|
Button::image(match &state.img_id_cache[i] {
|
||||||
Some((cached_kind, id)) if cached_kind == &kind => *id,
|
Some((cached_kind, id)) if cached_kind == &kind => *id,
|
||||||
_ => {
|
_ => {
|
||||||
@ -234,7 +241,11 @@ impl<'a> Widget for Bag<'a> {
|
|||||||
id
|
id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.w_h(30.0, 30.0)
|
.wh(if is_selected {
|
||||||
|
[30.0 + slot_anim.abs(); 2]
|
||||||
|
} else {
|
||||||
|
[30.0; 2]
|
||||||
|
})
|
||||||
.middle_of(state.ids.inv_slots[i]) // TODO: Items need to be assigned to a certain slot and then placed like in this example
|
.middle_of(state.ids.inv_slots[i]) // TODO: Items need to be assigned to a certain slot and then placed like in this example
|
||||||
//.label("5x") // TODO: Quantity goes here...
|
//.label("5x") // TODO: Quantity goes here...
|
||||||
//.label_font_id(self.fonts.opensans)
|
//.label_font_id(self.fonts.opensans)
|
||||||
|
@ -405,15 +405,14 @@ impl<'a> Widget for CharacterWindow<'a> {
|
|||||||
.set(state.charwindow_tab1_statnames, ui);
|
.set(state.charwindow_tab1_statnames, ui);
|
||||||
|
|
||||||
// TODO: Shows actual stat points.
|
// TODO: Shows actual stat points.
|
||||||
Text::new(
|
Text::new(&format!(
|
||||||
"1234\n\
|
"{}\n\
|
||||||
\n\
|
\n\
|
||||||
12312\n\
|
{}\n\
|
||||||
\n\
|
\n\
|
||||||
12414\n\
|
{}",
|
||||||
\n\
|
self.stats.endurance, self.stats.fitness, self.stats.willpower
|
||||||
124124",
|
))
|
||||||
)
|
|
||||||
.top_right_with_margins_on(state.charwindow_rectangle, 140.0, 5.0)
|
.top_right_with_margins_on(state.charwindow_rectangle, 140.0, 5.0)
|
||||||
.font_id(self.fonts.cyri)
|
.font_id(self.fonts.cyri)
|
||||||
.font_size(16)
|
.font_size(16)
|
||||||
|
@ -280,7 +280,6 @@ pub struct Show {
|
|||||||
esc_menu: bool,
|
esc_menu: bool,
|
||||||
open_windows: Windows,
|
open_windows: Windows,
|
||||||
map: bool,
|
map: bool,
|
||||||
inventory_test_button: bool,
|
|
||||||
mini_map: bool,
|
mini_map: bool,
|
||||||
ingame: bool,
|
ingame: bool,
|
||||||
settings_tab: SettingsTab,
|
settings_tab: SettingsTab,
|
||||||
@ -432,7 +431,6 @@ pub struct Hud {
|
|||||||
fonts: Fonts,
|
fonts: Fonts,
|
||||||
rot_imgs: ImgsRot,
|
rot_imgs: ImgsRot,
|
||||||
new_messages: VecDeque<ClientEvent>,
|
new_messages: VecDeque<ClientEvent>,
|
||||||
inventory_space: usize,
|
|
||||||
show: Show,
|
show: Show,
|
||||||
never_show: bool,
|
never_show: bool,
|
||||||
intro: bool,
|
intro: bool,
|
||||||
@ -475,7 +473,6 @@ impl Hud {
|
|||||||
fonts,
|
fonts,
|
||||||
ids,
|
ids,
|
||||||
new_messages: VecDeque::new(),
|
new_messages: VecDeque::new(),
|
||||||
inventory_space: 8,
|
|
||||||
intro: false,
|
intro: false,
|
||||||
intro_2: false,
|
intro_2: false,
|
||||||
show: Show {
|
show: Show {
|
||||||
@ -491,7 +488,6 @@ impl Hud {
|
|||||||
quest: false,
|
quest: false,
|
||||||
spell: false,
|
spell: false,
|
||||||
character_window: false,
|
character_window: false,
|
||||||
inventory_test_button: false,
|
|
||||||
mini_map: false,
|
mini_map: false,
|
||||||
settings_tab: SettingsTab::Interface,
|
settings_tab: SettingsTab::Interface,
|
||||||
social_tab: SocialTab::Online,
|
social_tab: SocialTab::Online,
|
||||||
@ -1519,26 +1515,6 @@ impl Hud {
|
|||||||
.set(self.ids.debug_info, ui_widgets);
|
.set(self.ids.debug_info, ui_widgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Bag-Space Button.
|
|
||||||
if self.show.inventory_test_button {
|
|
||||||
if Button::image(self.imgs.button)
|
|
||||||
.w_h(100.0, 100.0)
|
|
||||||
.middle_of(ui_widgets.window)
|
|
||||||
.label("Add 1 Space")
|
|
||||||
.label_font_size(20)
|
|
||||||
.label_color(TEXT_COLOR)
|
|
||||||
.hover_image(self.imgs.button_hover)
|
|
||||||
.press_image(self.imgs.button_press)
|
|
||||||
.set(self.ids.bag_space_add, ui_widgets)
|
|
||||||
.was_clicked()
|
|
||||||
{
|
|
||||||
if self.inventory_space < 100 {
|
|
||||||
self.inventory_space += 1;
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Help Text
|
// Help Text
|
||||||
if self.show.help && !self.show.map && !self.show.esc_menu {
|
if self.show.help && !self.show.map && !self.show.esc_menu {
|
||||||
Image::new(self.imgs.help)
|
Image::new(self.imgs.help)
|
||||||
@ -1621,6 +1597,7 @@ impl Hud {
|
|||||||
&self.fonts,
|
&self.fonts,
|
||||||
&self.rot_imgs,
|
&self.rot_imgs,
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
|
self.pulse,
|
||||||
)
|
)
|
||||||
.set(self.ids.bag, ui_widgets)
|
.set(self.ids.bag, ui_widgets)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user