mirror of
https://gitlab.com/veloren/veloren.git
synced 2025-07-25 04:42:23 +00:00
various fixes
This commit is contained in:
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
|
let own_level = stats
|
||||||
.get(client.entity())
|
.get(client.entity())
|
||||||
.map_or(0, |stats| stats.level.level());
|
.map_or(0, |stats| stats.level.level());
|
||||||
|
//self.input = client.read_storage::<comp::ControllerInputs>();
|
||||||
if let Some(stats) = stats.get(me) {
|
if let Some(stats) = stats.get(me) {
|
||||||
// Hurt Frame
|
// Hurt Frame
|
||||||
let hp_percentage =
|
let hp_percentage =
|
||||||
@ -1653,10 +1653,12 @@ impl Hud {
|
|||||||
let energy = ecs.read_storage::<comp::Energy>();
|
let energy = ecs.read_storage::<comp::Energy>();
|
||||||
let character_state = ecs.read_storage::<comp::CharacterState>();
|
let character_state = ecs.read_storage::<comp::CharacterState>();
|
||||||
let entity = client.entity();
|
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),
|
stats.get(entity),
|
||||||
energy.get(entity),
|
energy.get(entity),
|
||||||
character_state.get(entity),
|
character_state.get(entity),
|
||||||
|
controller.get(entity).map(|c| &c.inputs),
|
||||||
) {
|
) {
|
||||||
Skillbar::new(
|
Skillbar::new(
|
||||||
global_state,
|
global_state,
|
||||||
@ -1666,6 +1668,7 @@ impl Hud {
|
|||||||
&energy,
|
&energy,
|
||||||
&character_state,
|
&character_state,
|
||||||
self.pulse,
|
self.pulse,
|
||||||
|
&controller,
|
||||||
)
|
)
|
||||||
.set(self.ids.skillbar, ui_widgets);
|
.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,
|
/*FOCUS_COLOR, RAGE_COLOR,*/ HP_COLOR, LOW_HP_COLOR, MANA_COLOR, TEXT_COLOR, XP_COLOR,
|
||||||
};
|
};
|
||||||
use crate::GlobalState;
|
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::{
|
use conrod_core::{
|
||||||
color,
|
color,
|
||||||
widget::{self, Button, Image, Rectangle, Text},
|
widget::{self, Button, Image, Rectangle, Text},
|
||||||
@ -103,6 +105,7 @@ pub struct Skillbar<'a> {
|
|||||||
stats: &'a Stats,
|
stats: &'a Stats,
|
||||||
energy: &'a Energy,
|
energy: &'a Energy,
|
||||||
character_state: &'a CharacterState,
|
character_state: &'a CharacterState,
|
||||||
|
controller: &'a ControllerInputs,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
@ -118,6 +121,7 @@ impl<'a> Skillbar<'a> {
|
|||||||
energy: &'a Energy,
|
energy: &'a Energy,
|
||||||
character_state: &'a CharacterState,
|
character_state: &'a CharacterState,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
|
controller: &'a ControllerInputs,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
imgs,
|
imgs,
|
||||||
@ -129,6 +133,7 @@ impl<'a> Skillbar<'a> {
|
|||||||
common: widget::CommonBuilder::default(),
|
common: widget::CommonBuilder::default(),
|
||||||
character_state,
|
character_state,
|
||||||
pulse,
|
pulse,
|
||||||
|
controller,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -526,10 +531,15 @@ impl<'a> Widget for Skillbar<'a> {
|
|||||||
|
|
||||||
match self.character_state.action {
|
match self.character_state.action {
|
||||||
ActionState::Attack { .. } => {
|
ActionState::Attack { .. } => {
|
||||||
|
if self.controller.primary.is_pressed() {
|
||||||
let fade_pulse = (self.pulse * 4.0/*speed factor*/).cos() * 0.5 + 0.6; //Animation timer;
|
let fade_pulse = (self.pulse * 4.0/*speed factor*/).cos() * 0.5 + 0.6; //Animation timer;
|
||||||
Image::new(self.imgs.skillbar_slot_big)
|
Image::new(self.imgs.skillbar_slot_big)
|
||||||
.w_h(40.0 * scale, 40.0 * scale)
|
.w_h(40.0 * scale, 40.0 * scale)
|
||||||
.top_left_with_margins_on(state.ids.hotbar_align, -40.0 * scale, 0.0)
|
.top_left_with_margins_on(
|
||||||
|
state.ids.hotbar_align,
|
||||||
|
-40.0 * scale,
|
||||||
|
0.0,
|
||||||
|
)
|
||||||
.set(state.ids.m1_slot, ui);
|
.set(state.ids.m1_slot, ui);
|
||||||
Image::new(self.imgs.skillbar_slot_big_act)
|
Image::new(self.imgs.skillbar_slot_big_act)
|
||||||
.w_h(40.0 * scale, 40.0 * scale)
|
.w_h(40.0 * scale, 40.0 * scale)
|
||||||
@ -537,6 +547,16 @@ impl<'a> Widget for Skillbar<'a> {
|
|||||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, fade_pulse)))
|
.color(Some(Color::Rgba(1.0, 1.0, 1.0, fade_pulse)))
|
||||||
.floating(true)
|
.floating(true)
|
||||||
.set(state.ids.m1_slot_act, ui);
|
.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)
|
Image::new(self.imgs.skillbar_slot_big)
|
||||||
@ -548,7 +568,6 @@ impl<'a> Widget for Skillbar<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// M1 Slot
|
// M1 Slot
|
||||||
|
|
||||||
Image::new(self.imgs.skillbar_slot_big_bg)
|
Image::new(self.imgs.skillbar_slot_big_bg)
|
||||||
.w_h(38.0 * scale, 38.0 * scale)
|
.w_h(38.0 * scale, 38.0 * scale)
|
||||||
.color(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
|
.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) {
|
.w(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
|
||||||
Some(ItemKind::Tool { kind, .. }) => match kind {
|
Some(ItemKind::Tool { kind, .. }) => match kind {
|
||||||
Tool::Bow => 30.0 * scale,
|
Tool::Bow => 30.0 * scale,
|
||||||
Tool::Staff => 30.0 * scale,
|
Tool::Staff => 32.0 * scale,
|
||||||
_ => 38.0 * scale,
|
_ => 38.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) {
|
.h(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
|
||||||
Some(ItemKind::Tool { kind, .. }) => match kind {
|
Some(ItemKind::Tool { kind, .. }) => match kind {
|
||||||
Tool::Bow => 30.0 * scale,
|
Tool::Bow => 30.0 * scale,
|
||||||
Tool::Staff => 36.0 * scale,
|
Tool::Staff => 32.0 * scale,
|
||||||
_ => 38.0 * scale,
|
_ => 38.0 * scale,
|
||||||
},
|
},
|
||||||
_ => 38.0 * scale,
|
_ => 38.0 * scale,
|
||||||
@ -595,6 +614,7 @@ impl<'a> Widget for Skillbar<'a> {
|
|||||||
match self.character_state.action {
|
match self.character_state.action {
|
||||||
ActionState::Block { .. } => {
|
ActionState::Block { .. } => {
|
||||||
let fade_pulse = (self.pulse * 4.0/*speed factor*/).cos() * 0.5 + 0.6; //Animation timer;
|
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)
|
Image::new(self.imgs.skillbar_slot_big)
|
||||||
.w_h(40.0 * scale, 40.0 * scale)
|
.w_h(40.0 * scale, 40.0 * scale)
|
||||||
.right_from(state.ids.m1_slot, 0.0)
|
.right_from(state.ids.m1_slot, 0.0)
|
||||||
@ -605,6 +625,32 @@ impl<'a> Widget for Skillbar<'a> {
|
|||||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, fade_pulse)))
|
.color(Some(Color::Rgba(1.0, 1.0, 1.0, fade_pulse)))
|
||||||
.floating(true)
|
.floating(true)
|
||||||
.set(state.ids.m2_slot_act, ui);
|
.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)
|
Image::new(self.imgs.skillbar_slot_big)
|
||||||
|
Reference in New Issue
Block a user