mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
various fixes
This commit is contained in:
parent
480b920fa3
commit
6a32845e58
BIN
assets/voxygen/element/icons/staff_m2.vox
(Stored with Git LFS)
BIN
assets/voxygen/element/icons/staff_m2.vox
(Stored with Git LFS)
Binary file not shown.
@ -544,7 +544,7 @@ impl Hud {
|
||||
let own_level = stats
|
||||
.get(client.entity())
|
||||
.map_or(0, |stats| stats.level.level());
|
||||
|
||||
//self.input = client.read_storage::<comp::ControllerInputs>();
|
||||
if let Some(stats) = stats.get(me) {
|
||||
// Hurt Frame
|
||||
let hp_percentage =
|
||||
@ -1653,10 +1653,12 @@ impl Hud {
|
||||
let energy = ecs.read_storage::<comp::Energy>();
|
||||
let character_state = ecs.read_storage::<comp::CharacterState>();
|
||||
let entity = client.entity();
|
||||
if let (Some(stats), Some(energy), Some(character_state)) = (
|
||||
let controller = ecs.read_storage::<comp::Controller>();
|
||||
if let (Some(stats), Some(energy), Some(character_state), Some(controller)) = (
|
||||
stats.get(entity),
|
||||
energy.get(entity),
|
||||
character_state.get(entity),
|
||||
controller.get(entity).map(|c| &c.inputs),
|
||||
) {
|
||||
Skillbar::new(
|
||||
global_state,
|
||||
@ -1666,6 +1668,7 @@ impl Hud {
|
||||
&energy,
|
||||
&character_state,
|
||||
self.pulse,
|
||||
&controller,
|
||||
)
|
||||
.set(self.ids.skillbar, ui_widgets);
|
||||
}
|
||||
|
@ -3,7 +3,9 @@ use super::{
|
||||
/*FOCUS_COLOR, RAGE_COLOR,*/ HP_COLOR, LOW_HP_COLOR, MANA_COLOR, TEXT_COLOR, XP_COLOR,
|
||||
};
|
||||
use crate::GlobalState;
|
||||
use common::comp::{item::Debug, item::Tool, ActionState, CharacterState, Energy, ItemKind, Stats};
|
||||
use common::comp::{
|
||||
item::Debug, item::Tool, ActionState, CharacterState, ControllerInputs, Energy, ItemKind, Stats,
|
||||
};
|
||||
use conrod_core::{
|
||||
color,
|
||||
widget::{self, Button, Image, Rectangle, Text},
|
||||
@ -103,6 +105,7 @@ pub struct Skillbar<'a> {
|
||||
stats: &'a Stats,
|
||||
energy: &'a Energy,
|
||||
character_state: &'a CharacterState,
|
||||
controller: &'a ControllerInputs,
|
||||
pulse: f32,
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
@ -118,6 +121,7 @@ impl<'a> Skillbar<'a> {
|
||||
energy: &'a Energy,
|
||||
character_state: &'a CharacterState,
|
||||
pulse: f32,
|
||||
controller: &'a ControllerInputs,
|
||||
) -> Self {
|
||||
Self {
|
||||
imgs,
|
||||
@ -129,6 +133,7 @@ impl<'a> Skillbar<'a> {
|
||||
common: widget::CommonBuilder::default(),
|
||||
character_state,
|
||||
pulse,
|
||||
controller,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -526,17 +531,32 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
|
||||
match self.character_state.action {
|
||||
ActionState::Attack { .. } => {
|
||||
let fade_pulse = (self.pulse * 4.0/*speed factor*/).cos() * 0.5 + 0.6; //Animation timer;
|
||||
Image::new(self.imgs.skillbar_slot_big)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.top_left_with_margins_on(state.ids.hotbar_align, -40.0 * scale, 0.0)
|
||||
.set(state.ids.m1_slot, ui);
|
||||
Image::new(self.imgs.skillbar_slot_big_act)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.middle_of(state.ids.m1_slot)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, fade_pulse)))
|
||||
.floating(true)
|
||||
.set(state.ids.m1_slot_act, ui);
|
||||
if self.controller.primary.is_pressed() {
|
||||
let fade_pulse = (self.pulse * 4.0/*speed factor*/).cos() * 0.5 + 0.6; //Animation timer;
|
||||
Image::new(self.imgs.skillbar_slot_big)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.top_left_with_margins_on(
|
||||
state.ids.hotbar_align,
|
||||
-40.0 * scale,
|
||||
0.0,
|
||||
)
|
||||
.set(state.ids.m1_slot, ui);
|
||||
Image::new(self.imgs.skillbar_slot_big_act)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.middle_of(state.ids.m1_slot)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, fade_pulse)))
|
||||
.floating(true)
|
||||
.set(state.ids.m1_slot_act, ui);
|
||||
} else {
|
||||
Image::new(self.imgs.skillbar_slot_big)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.top_left_with_margins_on(
|
||||
state.ids.hotbar_align,
|
||||
-40.0 * scale,
|
||||
0.0,
|
||||
)
|
||||
.set(state.ids.m1_slot, ui);
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
Image::new(self.imgs.skillbar_slot_big)
|
||||
@ -548,7 +568,6 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
}
|
||||
}
|
||||
// M1 Slot
|
||||
|
||||
Image::new(self.imgs.skillbar_slot_big_bg)
|
||||
.w_h(38.0 * scale, 38.0 * scale)
|
||||
.color(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
|
||||
@ -576,7 +595,7 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
.w(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
|
||||
Some(ItemKind::Tool { kind, .. }) => match kind {
|
||||
Tool::Bow => 30.0 * scale,
|
||||
Tool::Staff => 30.0 * scale,
|
||||
Tool::Staff => 32.0 * scale,
|
||||
_ => 38.0 * scale,
|
||||
},
|
||||
_ => 38.0 * scale,
|
||||
@ -584,7 +603,7 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
.h(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
|
||||
Some(ItemKind::Tool { kind, .. }) => match kind {
|
||||
Tool::Bow => 30.0 * scale,
|
||||
Tool::Staff => 36.0 * scale,
|
||||
Tool::Staff => 32.0 * scale,
|
||||
_ => 38.0 * scale,
|
||||
},
|
||||
_ => 38.0 * scale,
|
||||
@ -595,16 +614,43 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
match self.character_state.action {
|
||||
ActionState::Block { .. } => {
|
||||
let fade_pulse = (self.pulse * 4.0/*speed factor*/).cos() * 0.5 + 0.6; //Animation timer;
|
||||
Image::new(self.imgs.skillbar_slot_big)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.right_from(state.ids.m1_slot, 0.0)
|
||||
.set(state.ids.m2_slot, ui);
|
||||
Image::new(self.imgs.skillbar_slot_big_act)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.middle_of(state.ids.m2_slot)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, fade_pulse)))
|
||||
.floating(true)
|
||||
.set(state.ids.m2_slot_act, ui);
|
||||
if self.controller.secondary.is_pressed() {
|
||||
Image::new(self.imgs.skillbar_slot_big)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.right_from(state.ids.m1_slot, 0.0)
|
||||
.set(state.ids.m2_slot, ui);
|
||||
Image::new(self.imgs.skillbar_slot_big_act)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.middle_of(state.ids.m2_slot)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, fade_pulse)))
|
||||
.floating(true)
|
||||
.set(state.ids.m2_slot_act, ui);
|
||||
} else {
|
||||
Image::new(self.imgs.skillbar_slot_big)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.right_from(state.ids.m1_slot, 0.0)
|
||||
.set(state.ids.m2_slot, ui);
|
||||
}
|
||||
}
|
||||
ActionState::Attack { .. } => {
|
||||
let fade_pulse = (self.pulse * 4.0/*speed factor*/).cos() * 0.5 + 0.6; //Animation timer;
|
||||
if self.controller.secondary.is_pressed() {
|
||||
Image::new(self.imgs.skillbar_slot_big)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.right_from(state.ids.m1_slot, 0.0)
|
||||
.set(state.ids.m2_slot, ui);
|
||||
Image::new(self.imgs.skillbar_slot_big_act)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.middle_of(state.ids.m2_slot)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, fade_pulse)))
|
||||
.floating(true)
|
||||
.set(state.ids.m2_slot_act, ui);
|
||||
} else {
|
||||
Image::new(self.imgs.skillbar_slot_big)
|
||||
.w_h(40.0 * scale, 40.0 * scale)
|
||||
.right_from(state.ids.m1_slot, 0.0)
|
||||
.set(state.ids.m2_slot, ui);
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
Image::new(self.imgs.skillbar_slot_big)
|
||||
|
Loading…
Reference in New Issue
Block a user