mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Charge Icon and flashing skillbar
This commit is contained in:
parent
8d2c69673d
commit
a4274ef8aa
@ -240,7 +240,7 @@
|
||||
"Ginger",
|
||||
"Gizmo",
|
||||
"Gwenivere",
|
||||
"Hagrid",
|
||||
"Hogrid",
|
||||
"Hazel",
|
||||
"Hector",
|
||||
"Herman",
|
||||
|
BIN
assets/voxygen/element/icons/skill_charge.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/skill_charge.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/skill_charge_2.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/skill_charge_2.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/skill_charge_3.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/skill_charge_3.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/icons/skill_slice_2.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/icons/skill_slice_2.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/skillbar/skillbar_slot_active.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/skillbar/skillbar_slot_active.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/skillbar/skillbar_slot_big_active.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/skillbar/skillbar_slot_big_active.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/skillbar/skillbar_slot_l_active.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/skillbar/skillbar_slot_l_active.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/element/skillbar/skillbar_slot_r_active.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/skillbar/skillbar_slot_r_active.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -30,10 +30,14 @@ image_ids! {
|
||||
xp_bar_left: "voxygen.element.skillbar.xp_bar_left",
|
||||
xp_bar_right: "voxygen.element.skillbar.xp_bar_right",
|
||||
skillbar_slot: "voxygen.element.skillbar.skillbar_slot",
|
||||
skillbar_slot_act: "voxygen.element.skillbar.skillbar_slot_active",
|
||||
skillbar_slot_l: "voxygen.element.skillbar.skillbar_slot_l",
|
||||
skillbar_slot_r: "voxygen.element.skillbar.skillbar_slot_r",
|
||||
skillbar_slot_l_act: "voxygen.element.skillbar.skillbar_slot_l_active",
|
||||
skillbar_slot_r_act: "voxygen.element.skillbar.skillbar_slot_r_active",
|
||||
skillbar_slot_bg: "voxygen.element.skillbar.skillbar_slot_bg",
|
||||
skillbar_slot_big: "voxygen.element.skillbar.skillbar_slot_big",
|
||||
skillbar_slot_big_act: "voxygen.element.skillbar.skillbar_slot_big_active",
|
||||
skillbar_slot_big_bg: "voxygen.element.skillbar.skillbar_slot_big_bg",
|
||||
healthbar_bg: "voxygen.element.skillbar.healthbar_bg",
|
||||
energybar_bg: "voxygen.element.skillbar.energybar_bg",
|
||||
@ -97,7 +101,12 @@ image_ids! {
|
||||
// Crosshair
|
||||
crosshair_inner: "voxygen.element.misc_bg.crosshair_inner",
|
||||
|
||||
// Icons
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
<VoxelMs9Graphic>
|
||||
|
||||
// Skill Icons
|
||||
twohsword_m1: "voxygen.element.icons.2hsword_m1",
|
||||
twohsword_m2: "voxygen.element.icons.2hsword_m2",
|
||||
twohhammer_m1: "voxygen.element.icons.2hhammer_m1",
|
||||
@ -111,8 +120,9 @@ image_ids! {
|
||||
flyingrod_m1: "voxygen.element.icons.debug_wand_m1",
|
||||
flyingrod_m2: "voxygen.element.icons.debug_wand_m2",
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
<VoxelMs9Graphic>
|
||||
charge: "voxygen.element.icons.skill_charge_2",
|
||||
|
||||
|
||||
// Icons
|
||||
flower: "voxygen.element.icons.item_flower",
|
||||
grass: "voxygen.element.icons.item_grass",
|
||||
|
@ -1649,14 +1649,20 @@ impl Hud {
|
||||
let ecs = client.state().ecs();
|
||||
let stats = ecs.read_storage::<comp::Stats>();
|
||||
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)) = (stats.get(entity), energy.get(entity)) {
|
||||
if let (Some(stats), Some(energy), Some(character_state)) = (
|
||||
stats.get(entity),
|
||||
energy.get(entity),
|
||||
character_state.get(entity),
|
||||
) {
|
||||
Skillbar::new(
|
||||
global_state,
|
||||
&self.imgs,
|
||||
&self.fonts,
|
||||
&stats,
|
||||
&energy,
|
||||
&character_state,
|
||||
self.pulse,
|
||||
)
|
||||
.set(self.ids.skillbar, ui_widgets);
|
||||
|
@ -3,7 +3,7 @@ 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, Energy, ItemKind, Stats};
|
||||
use common::comp::{item::Debug, item::Tool, ActionState, CharacterState, Energy, ItemKind, Stats};
|
||||
use conrod_core::{
|
||||
color,
|
||||
widget::{self, Button, Image, Rectangle, Text},
|
||||
@ -32,14 +32,18 @@ widget_ids! {
|
||||
m1_slot,
|
||||
m1_slot_bg,
|
||||
m1_text,
|
||||
m1_slot_act,
|
||||
m1_content,
|
||||
m2_slot,
|
||||
m2_slot_bg,
|
||||
m2_text,
|
||||
m2_slot_act,
|
||||
m2_content,
|
||||
slot1,
|
||||
slot1_bg,
|
||||
slot1_text,
|
||||
slot1_icon,
|
||||
slot1_act,
|
||||
slot2,
|
||||
slot2_bg,
|
||||
slot2_text,
|
||||
@ -98,6 +102,7 @@ pub struct Skillbar<'a> {
|
||||
fonts: &'a Fonts,
|
||||
stats: &'a Stats,
|
||||
energy: &'a Energy,
|
||||
character_state: &'a CharacterState,
|
||||
pulse: f32,
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
@ -111,6 +116,7 @@ impl<'a> Skillbar<'a> {
|
||||
fonts: &'a Fonts,
|
||||
stats: &'a Stats,
|
||||
energy: &'a Energy,
|
||||
character_state: &'a CharacterState,
|
||||
pulse: f32,
|
||||
) -> Self {
|
||||
Self {
|
||||
@ -121,6 +127,7 @@ impl<'a> Skillbar<'a> {
|
||||
global_state,
|
||||
current_resource: ResourceType::Mana,
|
||||
common: widget::CommonBuilder::default(),
|
||||
character_state,
|
||||
pulse,
|
||||
}
|
||||
}
|
||||
@ -516,13 +523,32 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
.mid_bottom_with_margin_on(ui.window, 9.0)
|
||||
.set(state.ids.hotbar_align, ui);
|
||||
// M1 Slot
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
_ => {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// M1 Slot
|
||||
|
||||
Image::new(self.imgs.skillbar_slot_big_bg)
|
||||
.w_h(36.0 * scale, 36.0 * scale)
|
||||
.color(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
|
||||
@ -566,10 +592,28 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
.middle_of(state.ids.m1_slot_bg)
|
||||
.set(state.ids.m1_content, ui);
|
||||
// M2 Slot
|
||||
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);
|
||||
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);
|
||||
}
|
||||
_ => {
|
||||
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_bg)
|
||||
.w_h(36.0 * scale, 36.0 * scale)
|
||||
.color(match self.stats.equipment.main.as_ref().map(|i| &i.kind) {
|
||||
@ -653,15 +697,45 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
.middle_of(state.ids.slot2)
|
||||
.set(state.ids.slot2_bg, ui);
|
||||
// Slot 1
|
||||
Image::new(self.imgs.skillbar_slot_l)
|
||||
.w_h(20.0 * scale, 20.0 * scale)
|
||||
.left_from(state.ids.slot2, 0.0)
|
||||
.set(state.ids.slot1, ui);
|
||||
// TODO: Don't hardcode this to one Skill...
|
||||
// Frame flashes whenever the active skill inside this slot is activated
|
||||
match self.character_state.action {
|
||||
ActionState::Charge { time_left } => {
|
||||
let fade = time_left.as_secs_f32() * 10.0;
|
||||
Image::new(self.imgs.skillbar_slot_l)
|
||||
.w_h(20.0 * scale, 20.0 * scale)
|
||||
.left_from(state.ids.slot2, 0.0)
|
||||
.set(state.ids.slot1, ui);
|
||||
Image::new(self.imgs.skillbar_slot_l_act)
|
||||
.w_h(20.0 * scale, 20.0 * scale)
|
||||
.middle_of(state.ids.slot1)
|
||||
.color(Some(Color::Rgba(
|
||||
1.0,
|
||||
1.0,
|
||||
1.0,
|
||||
if fade > 0.6 { 0.6 } else { fade },
|
||||
)))
|
||||
.floating(true)
|
||||
.set(state.ids.slot1_act, ui);
|
||||
}
|
||||
_ => {
|
||||
Image::new(self.imgs.skillbar_slot_l)
|
||||
.w_h(20.0 * scale, 20.0 * scale)
|
||||
.left_from(state.ids.slot2, 0.0)
|
||||
.set(state.ids.slot1, ui);
|
||||
}
|
||||
}
|
||||
Image::new(self.imgs.skillbar_slot_bg)
|
||||
.w_h(19.0 * scale, 19.0 * scale)
|
||||
.color(Some(BG_COLOR))
|
||||
.middle_of(state.ids.slot1)
|
||||
.set(state.ids.slot1_bg, ui);
|
||||
// TODO: Changeable slot image
|
||||
Image::new(self.imgs.charge)
|
||||
.w_h(18.0 * scale, 18.0 * scale)
|
||||
//.color(Some(BG_COLOR))
|
||||
.middle_of(state.ids.slot1_bg)
|
||||
.set(state.ids.slot1_icon, ui);
|
||||
// Slot 6
|
||||
Image::new(self.imgs.skillbar_slot)
|
||||
.w_h(20.0 * scale, 20.0 * scale)
|
||||
|
@ -88,7 +88,7 @@ impl Default for ControlSettings {
|
||||
respawn: KeyMouse::Key(VirtualKeyCode::Space),
|
||||
interact: KeyMouse::Mouse(MouseButton::Right),
|
||||
toggle_wield: KeyMouse::Key(VirtualKeyCode::T),
|
||||
charge: KeyMouse::Key(VirtualKeyCode::V),
|
||||
charge: KeyMouse::Key(VirtualKeyCode::Key1),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -281,10 +281,7 @@ impl<'a> BlockGen<'a> {
|
||||
&& (marble * 3173.7).fract() < 0.6
|
||||
&& humidity > 0.4
|
||||
{
|
||||
let treasures = [
|
||||
BlockKind::Chest,
|
||||
//BlockKind::Velorite,
|
||||
];
|
||||
let treasures = [BlockKind::Chest, BlockKind::Velorite];
|
||||
|
||||
let flowers = [
|
||||
BlockKind::BlueFlower,
|
||||
@ -334,14 +331,6 @@ impl<'a> BlockGen<'a> {
|
||||
},
|
||||
Rgb::broadcast(0),
|
||||
))
|
||||
} else if (wposf.z as f32) < height + 0.9
|
||||
&& chaos > 0.6
|
||||
&& (wposf.z as f32 > water_height + 3.0)
|
||||
&& marble > 0.75
|
||||
&& marble_small > 0.3
|
||||
&& (marble * 7323.07).fract() < 0.75
|
||||
{
|
||||
Some(Block::new(BlockKind::Velorite, Rgb::broadcast(0)))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user