mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
decayed health texture
This commit is contained in:
parent
cc70560027
commit
345b725478
BIN
assets/voxygen/element/skillbar/decayed_bg.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/skillbar/decayed_bg.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/skillbar/flame_0.png
(Stored with Git LFS)
BIN
assets/voxygen/element/skillbar/flame_0.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/skillbar/flame_1.png
(Stored with Git LFS)
BIN
assets/voxygen/element/skillbar/flame_1.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/skillbar/flame_2.png
(Stored with Git LFS)
BIN
assets/voxygen/element/skillbar/flame_2.png
(Stored with Git LFS)
Binary file not shown.
@ -217,6 +217,6 @@ fn empty_ability_info() -> states::utils::AbilityInfo {
|
|||||||
tool: None,
|
tool: None,
|
||||||
hand: None,
|
hand: None,
|
||||||
input: InputKind::Primary,
|
input: InputKind::Primary,
|
||||||
select_pos: None,
|
input_attr: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,6 +353,6 @@ fn empty_ability_info() -> states::utils::AbilityInfo {
|
|||||||
tool: None,
|
tool: None,
|
||||||
hand: None,
|
hand: None,
|
||||||
input: InputKind::Primary,
|
input: InputKind::Primary,
|
||||||
select_pos: None,
|
input_attr: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,9 +124,11 @@ impl<'a> Widget for BuffsBar<'a> {
|
|||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
.desc_text_color(TEXT_COLOR);
|
.desc_text_color(TEXT_COLOR);
|
||||||
if let BuffPosition::Bar = buff_position {
|
if let BuffPosition::Bar = buff_position {
|
||||||
let show_health = self.health.current() != self.health.maximum();
|
let decayed_health = 1.0 - self.health.maximum() as f64 / self.health.base_max() as f64;
|
||||||
|
let show_health =
|
||||||
|
self.health.current() != self.health.maximum() || decayed_health > 0.0;
|
||||||
let show_stamina = self.energy.current() != self.energy.maximum();
|
let show_stamina = self.energy.current() != self.energy.maximum();
|
||||||
let offset = if show_health && show_stamina {
|
let offset = if show_stamina && show_health {
|
||||||
140.0
|
140.0
|
||||||
} else if show_health || show_stamina {
|
} else if show_health || show_stamina {
|
||||||
95.0
|
95.0
|
||||||
|
@ -299,9 +299,7 @@ image_ids! {
|
|||||||
skillbar_frame: "voxygen.element.skillbar.frame",
|
skillbar_frame: "voxygen.element.skillbar.frame",
|
||||||
health_bg: "voxygen.element.skillbar.health_bg",
|
health_bg: "voxygen.element.skillbar.health_bg",
|
||||||
health_frame: "voxygen.element.skillbar.health_frame",
|
health_frame: "voxygen.element.skillbar.health_frame",
|
||||||
flame_frame_0: "voxygen.element.skillbar.flame_0",
|
decayed_bg: "voxygen.element.skillbar.decayed_bg",
|
||||||
flame_frame_1: "voxygen.element.skillbar.flame_1",
|
|
||||||
flame_frame_2: "voxygen.element.skillbar.flame_2",
|
|
||||||
stamina_bg: "voxygen.element.skillbar.stamina_bg",
|
stamina_bg: "voxygen.element.skillbar.stamina_bg",
|
||||||
stamina_frame: "voxygen.element.skillbar.stamina_frame",
|
stamina_frame: "voxygen.element.skillbar.stamina_frame",
|
||||||
m1_ico: "voxygen.element.icons.m1",
|
m1_ico: "voxygen.element.icons.m1",
|
||||||
|
@ -3,7 +3,7 @@ use super::{
|
|||||||
img_ids::{Imgs, ImgsRot},
|
img_ids::{Imgs, ImgsRot},
|
||||||
item_imgs::ItemImgs,
|
item_imgs::ItemImgs,
|
||||||
slots, BarNumbers, ShortcutNumbers, BLACK, CRITICAL_HP_COLOR, HP_COLOR, LOW_HP_COLOR,
|
slots, BarNumbers, ShortcutNumbers, BLACK, CRITICAL_HP_COLOR, HP_COLOR, LOW_HP_COLOR,
|
||||||
STAMINA_COLOR, QUALITY_EPIC, TEXT_COLOR, UI_HIGHLIGHT_0,
|
QUALITY_EPIC, STAMINA_COLOR, TEXT_COLOR, UI_HIGHLIGHT_0,
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
hud::ComboFloater,
|
hud::ComboFloater,
|
||||||
@ -31,8 +31,6 @@ use conrod_core::{
|
|||||||
widget_ids, Color, Colorable, Positionable, Sizeable, Widget, WidgetCommon,
|
widget_ids, Color, Colorable, Positionable, Sizeable, Widget, WidgetCommon,
|
||||||
};
|
};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use rand::Rng;
|
|
||||||
use inline_tweak::*;
|
|
||||||
|
|
||||||
widget_ids! {
|
widget_ids! {
|
||||||
struct Ids {
|
struct Ids {
|
||||||
@ -73,8 +71,7 @@ widget_ids! {
|
|||||||
hp_txt_alignment,
|
hp_txt_alignment,
|
||||||
hp_txt_bg,
|
hp_txt_bg,
|
||||||
hp_txt,
|
hp_txt,
|
||||||
decay_flames,
|
decay_overlay,
|
||||||
decay_flames_align,
|
|
||||||
// Stamina-Bar
|
// Stamina-Bar
|
||||||
stamina_alignment,
|
stamina_alignment,
|
||||||
stamina_filling,
|
stamina_filling,
|
||||||
@ -293,8 +290,9 @@ impl<'a> Widget for Skillbar<'a> {
|
|||||||
// Health and Stamina bar
|
// Health and Stamina bar
|
||||||
let show_health = self.health.current() != self.health.maximum();
|
let show_health = self.health.current() != self.health.maximum();
|
||||||
let show_stamina = self.energy.current() != self.energy.maximum();
|
let show_stamina = self.energy.current() != self.energy.maximum();
|
||||||
|
let decayed_health = 1.0 - self.health.maximum() as f64 / self.health.base_max() as f64;
|
||||||
|
|
||||||
if show_health && !self.health.is_dead {
|
if show_health && !self.health.is_dead || decayed_health > 0.0 {
|
||||||
let offset = 1.0;
|
let offset = 1.0;
|
||||||
Image::new(self.imgs.health_bg)
|
Image::new(self.imgs.health_bg)
|
||||||
.w_h(484.0, 24.0)
|
.w_h(484.0, 24.0)
|
||||||
@ -313,7 +311,6 @@ impl<'a> Widget for Skillbar<'a> {
|
|||||||
.color(Some(health_col))
|
.color(Some(health_col))
|
||||||
.top_left_with_margins_on(state.ids.hp_alignment, 0.0, 0.0)
|
.top_left_with_margins_on(state.ids.hp_alignment, 0.0, 0.0)
|
||||||
.set(state.ids.hp_filling, ui);
|
.set(state.ids.hp_filling, ui);
|
||||||
let decayed_health = 1.0 - self.health.maximum() as f64 / self.health.base_max() as f64;
|
|
||||||
|
|
||||||
if decayed_health > 0.0 {
|
if decayed_health > 0.0 {
|
||||||
let decay_bar_len = 480.0 * decayed_health * 0.5;
|
let decay_bar_len = 480.0 * decayed_health * 0.5;
|
||||||
@ -321,24 +318,15 @@ impl<'a> Widget for Skillbar<'a> {
|
|||||||
.w_h(decay_bar_len, 18.0)
|
.w_h(decay_bar_len, 18.0)
|
||||||
.color(Some(QUALITY_EPIC))
|
.color(Some(QUALITY_EPIC))
|
||||||
.top_right_with_margins_on(state.ids.hp_alignment, 0.0, 0.0)
|
.top_right_with_margins_on(state.ids.hp_alignment, 0.0, 0.0)
|
||||||
.set(state.ids.hp_decayed, ui);
|
|
||||||
Rectangle::fill_with([decay_bar_len, 12.0], color::TRANSPARENT)
|
|
||||||
.top_right_with_margins_on(state.ids.hp_decayed, tweak!(-11.0), 0.0)
|
|
||||||
.crop_kids()
|
.crop_kids()
|
||||||
.set(state.ids.decay_flames_align, ui);
|
.set(state.ids.hp_decayed, ui);
|
||||||
let mut rng = rand::thread_rng();
|
|
||||||
let max = tweak!(2);
|
|
||||||
let frame_no = rng.gen_range(0..max);
|
|
||||||
Image::new(match frame_no {
|
|
||||||
0 => self.imgs.flame_frame_0,
|
|
||||||
1 => self.imgs.flame_frame_2,
|
|
||||||
_ => self.imgs.flame_frame_0,
|
|
||||||
})
|
|
||||||
.w_h(480.0, 12.0)
|
|
||||||
.color(Some(QUALITY_EPIC))
|
|
||||||
.bottom_right_with_margins_on(state.ids.decay_flames_align, 0.0, 0.0)
|
|
||||||
.set(state.ids.decay_flames, ui);
|
|
||||||
|
|
||||||
|
Image::new(self.imgs.decayed_bg)
|
||||||
|
.w_h(480.0, 18.0)
|
||||||
|
.color(Some(Color::Rgba(0.58, 0.29, 0.93, (hp_ani + 0.6).min(1.0))))
|
||||||
|
.top_left_with_margins_on(state.ids.hp_alignment, 0.0, 0.0)
|
||||||
|
.parent(state.ids.hp_decayed)
|
||||||
|
.set(state.ids.decay_overlay, ui);
|
||||||
}
|
}
|
||||||
Image::new(self.imgs.health_frame)
|
Image::new(self.imgs.health_frame)
|
||||||
.w_h(484.0, 24.0)
|
.w_h(484.0, 24.0)
|
||||||
@ -347,7 +335,11 @@ impl<'a> Widget for Skillbar<'a> {
|
|||||||
.set(state.ids.frame_health, ui);
|
.set(state.ids.frame_health, ui);
|
||||||
}
|
}
|
||||||
if show_stamina && !self.health.is_dead {
|
if show_stamina && !self.health.is_dead {
|
||||||
let offset = if show_health { 34.0 } else { 1.0 };
|
let offset = if show_health || decayed_health > 0.0 {
|
||||||
|
34.0
|
||||||
|
} else {
|
||||||
|
1.0
|
||||||
|
};
|
||||||
Image::new(self.imgs.stamina_bg)
|
Image::new(self.imgs.stamina_bg)
|
||||||
.w_h(323.0, 16.0)
|
.w_h(323.0, 16.0)
|
||||||
.mid_top_with_margin_on(state.ids.frame, -offset)
|
.mid_top_with_margin_on(state.ids.frame, -offset)
|
||||||
|
Loading…
Reference in New Issue
Block a user