skillbar fixes, buff UI module

adjustments, fixes, assets, test buffs widgets
This commit is contained in:
Monty Marz 2020-10-12 23:45:51 +02:00 committed by Sam
parent 60a5346a0b
commit b31c6877b4
16 changed files with 352 additions and 110 deletions

View File

@ -0,0 +1,12 @@
ItemDef(
name: "Rugged Backpack",
description: "Keeps all your stuff together.",
kind: Armor(
(
kind: Back("Backpack0"),
stats: (
protection: Normal(0.0)),
)
),
quality: Moderate,
)

View File

@ -0,0 +1,12 @@
ItemDef(
name: "Rugged Backpack",
description: "Keeps all your stuff together.",
kind: Armor(
(
kind: Back("BackpackBlue0"),
stats: (
protection: Normal(0.0)),
)
),
quality: Moderate,
)

BIN
assets/voxygen/element/de_buffs/buff_plus_0.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/de_buffs/debuff_skull_0.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/skillbar/bg.png (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/element/skillbar/frame.png (Stored with Git LFS)

Binary file not shown.

View File

@ -65,6 +65,7 @@ VoxygenLocalization(
"common.create": "Crear", "common.create": "Crear",
"common.okay": "Ok", "common.okay": "Ok",
"common.accept": "Aceptar", "common.accept": "Aceptar",
"common.decline": "Rechazar",
"common.disclaimer": "Cuidado", "common.disclaimer": "Cuidado",
"common.cancel": "Cancelar", "common.cancel": "Cancelar",
"common.none": "Ninguno", "common.none": "Ninguno",
@ -73,6 +74,13 @@ VoxygenLocalization(
"common.you": "Tu", "common.you": "Tu",
"common.automatic": "Automatico", "common.automatic": "Automatico",
"common.random": "Aleatorio", "common.random": "Aleatorio",
// Settings Window title
"common.interface_settings": "Ajustes de Interfaz",
"common.gameplay_settings": "Ajustes de Jugabilidad",
"common.controls_settings": "Ajustes de Controles",
"common.video_settings": "Ajustes de Graficos",
"common.sound_settings": "Ajustes de Sonido",
"common.language_settings": "Ajustes de Idiomas",
// Message when connection to the server is lost // Message when connection to the server is lost
"common.connection_lost": r#"Conexión perdida! "common.connection_lost": r#"Conexión perdida!
@ -89,9 +97,11 @@ El cliente está actualizado?"#,
"common.weapons.axe": "Hacha", "common.weapons.axe": "Hacha",
"common.weapons.sword": "Espada", "common.weapons.sword": "Espada",
"common.weapons.staff": "Báculo", "common.weapons.staff": "Vara Mágica",
"common.weapons.bow": "Arco", "common.weapons.bow": "Arco",
"common.weapons.hammer": "Martillo", "common.weapons.hammer": "Martillo",
"common.weapons.sceptre": "Cetro curativo",
"common.rand_appearance": "Nombre y Apariencia Aleatoria",
/// End Common section /// End Common section
@ -141,6 +151,9 @@ https://account.veloren.net."#,
"main.login.invalid_character": "El personaje seleccionado no es válido", "main.login.invalid_character": "El personaje seleccionado no es válido",
"main.login.client_crashed": "El cliente crasheó", "main.login.client_crashed": "El cliente crasheó",
"main.login.not_on_whitelist": "No estas en la lista. Contacta al Dueño del Servidor si quieres unirte.", "main.login.not_on_whitelist": "No estas en la lista. Contacta al Dueño del Servidor si quieres unirte.",
"main.login.banned": "Usted ha sido baneado por la siguiente razón",
"main.login.kicked": "Te han echado por la siguiente razón",
/// End Main screen section /// End Main screen section
@ -153,6 +166,7 @@ https://account.veloren.net."#,
"hud.waypoint_saved": "Marcador Guardado", "hud.waypoint_saved": "Marcador Guardado",
"hud.press_key_to_show_keybindings_fmt": "Presiona {key} para mostrar los controles del teclado", "hud.press_key_to_show_keybindings_fmt": "Presiona {key} para mostrar los controles del teclado",
"hud.press_key_to_toggle_lantern_fmt": "[{key}] Encender Linterna",
"hud.press_key_to_show_debug_info_fmt": "Presiona {key} para mostrar información de depuración", "hud.press_key_to_show_debug_info_fmt": "Presiona {key} para mostrar información de depuración",
"hud.press_key_to_toggle_keybindings_fmt": "Presiona {key} para alternar los controles del teclado", "hud.press_key_to_toggle_keybindings_fmt": "Presiona {key} para alternar los controles del teclado",
"hud.press_key_to_toggle_debug_info_fmt": "Presiona {key} para alternar la información de depuración", "hud.press_key_to_toggle_debug_info_fmt": "Presiona {key} para alternar la información de depuración",
@ -160,6 +174,21 @@ https://account.veloren.net."#,
// Chat outputs // Chat outputs
"hud.chat.online_msg": "[{name}] se ha conectado.", "hud.chat.online_msg": "[{name}] se ha conectado.",
"hud.chat.offline_msg": "[{name}] se ha desconectado.", "hud.chat.offline_msg": "[{name}] se ha desconectado.",
"hud.chat.default_death_msg": "[{name}] Murió",
"hud.chat.environmental_kill_msg": "[{name}] Murió en {environment}",
"hud.chat.fall_kill_msg": "[{name}] Murió por el daño de la caída",
"hud.chat.suicide_msg": "[{name}] Murió por heridas autoinfligidas",
"hud.chat.pvp_melee_kill_msg": "[{attacker}] Derroto a [{victim}]",
"hud.chat.pvp_ranged_kill_msg": "[{attacker}] Le Disparo a [{victim}]",
"hud.chat.pvp_explosion_kill_msg": "[{attacker}] Hizo explotar a [{victim}]",
"hud.chat.pvp_energy_kill_msg": "[{attacker}] usó magia para matar [{victim}]",
"hud.chat.npc_melee_kill_msg": "{attacker} Mató a [{victim}]",
"hud.chat.npc_ranged_kill_msg": "{attacker} Le Disparo a [{victim}]",
"hud.chat.npc_explosion_kill_msg": "{attacker} Hizo explotar a [{victim}]",
"hud.chat.loot_msg": "Recogiste [{item}]", "hud.chat.loot_msg": "Recogiste [{item}]",
"hud.chat.loot_fail": "Tu inventario está lleno!", "hud.chat.loot_fail": "Tu inventario está lleno!",
"hud.chat.goodbye": "Adiós!", "hud.chat.goodbye": "Adiós!",
@ -197,7 +226,7 @@ Deshazte de ellos haciendo click en ellos y luego arrastralos fuera de la bolsa.
Las noches pueden volverse bastante oscuras en Veloren. Las noches pueden volverse bastante oscuras en Veloren.
Enciende tu farol escribiendo /lantern en el chat o presionando la G. Enciende tu Linterna escribiendo /lantern en el chat o presionando la G.
Quieres liberar tu cursor para cerrar esta ventana? Presiona TAB! Quieres liberar tu cursor para cerrar esta ventana? Presiona TAB!
@ -232,6 +261,7 @@ objetos infundidos con magia?"#,
"hud.bag.chest": "Torso", "hud.bag.chest": "Torso",
"hud.bag.hands": "Manos", "hud.bag.hands": "Manos",
"hud.bag.lantern": "Linterna", "hud.bag.lantern": "Linterna",
"hud.bag.glider": "Planeador",
"hud.bag.belt": "Cinturón", "hud.bag.belt": "Cinturón",
"hud.bag.ring": "Anillo", "hud.bag.ring": "Anillo",
"hud.bag.back": "Espalda", "hud.bag.back": "Espalda",
@ -282,8 +312,8 @@ objetos infundidos con magia?"#,
"hud.settings.invert_scroll_zoom": "Invertir Desplazamiento de Zoom", "hud.settings.invert_scroll_zoom": "Invertir Desplazamiento de Zoom",
"hud.settings.invert_mouse_y_axis": "Invertir eje Y del Ratón", "hud.settings.invert_mouse_y_axis": "Invertir eje Y del Ratón",
"hud.settings.enable_mouse_smoothing": "Suavizado de la Cámara", "hud.settings.enable_mouse_smoothing": "Suavizado de la Cámara",
"hud.settings.free_look_behavior": "Comportamiento de vista libre", "hud.settings.free_look_behavior": "Modo de vista libre",
"hud.settings.auto_walk_behavior": "Comportamiento al caminar automaticamente", "hud.settings.auto_walk_behavior": "Modo de caminata automática",
"hud.settings.stop_auto_walk_on_input": "Frenar caminata automática", "hud.settings.stop_auto_walk_on_input": "Frenar caminata automática",
"hud.settings.view_distance": "Distancia de Visión", "hud.settings.view_distance": "Distancia de Visión",
@ -292,22 +322,43 @@ objetos infundidos con magia?"#,
"hud.settings.maximum_fps": "FPS Máximos", "hud.settings.maximum_fps": "FPS Máximos",
"hud.settings.fov": "Campo de Visión (grados)", "hud.settings.fov": "Campo de Visión (grados)",
"hud.settings.gamma": "Gama", "hud.settings.gamma": "Gama",
"hud.settings.ambiance": "Brillo del Ambiente",
"hud.settings.antialiasing_mode": "Modo Anti-Aliasing", "hud.settings.antialiasing_mode": "Modo Anti-Aliasing",
"hud.settings.cloud_rendering_mode": "Modo de Renderizado de Nubes", "hud.settings.cloud_rendering_mode": "Modo de Renderizado de Nubes",
"hud.settings.fluid_rendering_mode": "Modo de Renderizado de Fluidos", "hud.settings.fluid_rendering_mode": "Modo de Renderizado del Agua",
"hud.settings.fluid_rendering_mode.cheap": "Barato", "hud.settings.fluid_rendering_mode.cheap": "Bajo",
"hud.settings.fluid_rendering_mode.shiny": "Brillante", "hud.settings.fluid_rendering_mode.shiny": "Alto",
"hud.settings.cloud_rendering_mode.regular": "Regular", "hud.settings.cloud_rendering_mode.regular": "Normal",
"hud.settings.fullscreen": "Pantalla Completa", "hud.settings.fullscreen": "Pantalla Completa",
"hud.settings.save_window_size": "Guardar tamaño de la ventana", "hud.settings.fullscreen_mode": "Modo de Pantalla Completa",
"hud.settings.fullscreen_mode.exclusive": "Completo",
"hud.settings.fullscreen_mode.borderless": "Con Bordes",
"hud.settings.particles": "Particulas",
"hud.settings.resolution": "Resolución",
"hud.settings.bit_depth": "Profundidad de Bits",
"hud.settings.refresh_rate": "Taza de Refresco",
"hud.settings.save_window_size": " Guardar tamaño de ventana",
"hud.settings.shadow_rendering_mode": "Renderizado de Sombras",
"hud.settings.shadow_rendering_mode.none": "Ninguno",
"hud.settings.shadow_rendering_mode.cheap": "Bajo",
"hud.settings.shadow_rendering_mode.map": "Alto",
"hud.settings.lighting_rendering_mode": "Renderizado de la luz de la Linterna",
"hud.settings.lighting_rendering_mode.ashikhmin": "Tipo A",
"hud.settings.lighting_rendering_mode.blinnphong": "Tipo B",
"hud.settings.lighting_rendering_mode.lambertian": "Tipo L",
"hud.settings.shadow_rendering_mode": "Renderizado de Sombras",
"hud.settings.shadow_rendering_mode.none": "Ninguno",
"hud.settings.shadow_rendering_mode.cheap": "Bajo",
"hud.settings.shadow_rendering_mode.map": "Alto",
"hud.settings.shadow_rendering_mode.map.resolution": "Resolución",
"hud.settings.lod_detail": "Detalle de LoD",
"hud.settings.music_volume": "Volumen de Musica", "hud.settings.music_volume": "Volumen de Musica",
"hud.settings.sound_effect_volume": "Volumen de Efectos de Sonido", "hud.settings.sound_effect_volume": "Volumen de Efectos de Sonido",
"hud.settings.audio_device": "Dispositivo de Audio", "hud.settings.audio_device": "Dispositivo de Audio",
"hud.settings.awaitingkey": "Presiona una tecla...", "hud.settings.awaitingkey": "Presiona una tecla...",
"hud.settings.unbound": "Ninguno", "hud.settings.unbound": "Ninguno",
"hud.settings.reset_keybinds": "Reestablecer a los valores predeterminados", "hud.settings.reset_keybinds": "Reestablecer Controles",
"hud.social": "Lista de jugadores", "hud.social": "Lista de jugadores",
"hud.social.online": "En Línea", "hud.social.online": "En Línea",
@ -315,6 +366,10 @@ objetos infundidos con magia?"#,
"hud.social.not_yet_available": "Aún no esta disponible", "hud.social.not_yet_available": "Aún no esta disponible",
"hud.social.faction": "Facción", "hud.social.faction": "Facción",
"hud.social.play_online_fmt": "{nb_player} jugador(es) en línea", "hud.social.play_online_fmt": "{nb_player} jugador(es) en línea",
"hud.social.name": "Nombre",
"hud.social.level": "Nivel",
"hud.social.zone": "Zona",
"hud.social.account": "Cuenta",
"hud.crafting": "Crafteo", "hud.crafting": "Crafteo",
"hud.crafting.recipes": "Recetas", "hud.crafting.recipes": "Recetas",
@ -322,6 +377,19 @@ objetos infundidos con magia?"#,
"hud.crafting.craft": "Fabricar", "hud.crafting.craft": "Fabricar",
"hud.crafting.tool_cata": "Requisitos:", "hud.crafting.tool_cata": "Requisitos:",
"hud.group": "Grupo",
"hud.group.invite_to_join": "{name} Te invito a su Grupo!",
"hud.group.invite": "Invitar",
"hud.group.kick": "Echar",
"hud.group.assign_leader": "Asignar Lider",
"hud.group.leave": "Salir del Grupo",
"hud.group.dead" : "Muerto",
"hud.group.out_of_range": "Fuera de Alcance",
"hud.group.add_friend": "Agregar a Amigos",
"hud.group.link_group": "Conectar Grupos",
"hud.group.in_menu": "Eligiendo Personaje",
"hud.group.members": "Miembros del Grupo",
"hud.spell": "Hechizos", "hud.spell": "Hechizos",
"hud.free_look_indicator": "Vista libre activa", "hud.free_look_indicator": "Vista libre activa",
@ -381,6 +449,9 @@ objetos infundidos con magia?"#,
"gameinput.freelook": "Vista Libre", "gameinput.freelook": "Vista Libre",
"gameinput.autowalk": "Caminata Automática", "gameinput.autowalk": "Caminata Automática",
"gameinput.dance": "Bailar", "gameinput.dance": "Bailar",
"gameinput.select": "Seleccione la Entidad",
"gameinput.acceptgroupinvite": "Aceptar invitación al grupo",
"gameinput.declinegroupinvite": "Rechazar invitación al grupo",
"gameinput.crafting": "Craftear", "gameinput.crafting": "Craftear",
"gameinput.sneak": "Agacharse", "gameinput.sneak": "Agacharse",
"gameinput.swimdown": "Sumergirse", "gameinput.swimdown": "Sumergirse",
@ -423,7 +494,7 @@ objetos infundidos con magia?"#,
Estado Físico Estado Físico
Fuerza de Voluntad Valentía
Protección Protección
"#, "#,

View File

@ -1099,6 +1099,14 @@
"voxel.armor.back.short-2", "voxel.armor.back.short-2",
(0.0, -2.0, 0.0), (-90.0, 180.0, 0.0), 1.0, (0.0, -2.0, 0.0), (-90.0, 180.0, 0.0), 1.0,
), ),
Armor(Back("Backpack0")): VoxTrans(
"voxel.armor.back.backpack-0",
(0.0, 0.0, 0.0), (-90.0, 0.0, 0.0), 1.0,
),
Armor(Back("BackpackBlue0")): VoxTrans(
"voxel.armor.back.backpack-0",
(0.0, 0.0, 0.0), (-90.0, 0.0, 0.0), 1.0,
),
// Rings // Rings
Armor(Ring("Ring0")): Png( Armor(Ring("Ring0")): Png(
"element.icons.ring-0", "element.icons.ring-0",

BIN
assets/voxygen/voxel/armor/back/backpack-0.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/armor/back/backpack-grey.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -24,5 +24,13 @@
vox_spec: ("armor.back.short-2", (-5.0, -1.0, -11.0)), vox_spec: ("armor.back.short-2", (-5.0, -1.0, -11.0)),
color: None color: None
), ),
"Backpack0": (
vox_spec: ("armor.back.backpack-0", (-7.0, -5.0, -10.0)),
color: None
),
"BackpackBlue0": (
vox_spec: ("armor.back.backpack-grey", (-7.0, -5.0, -10.0)),
color: Some((76, 72, 178))
),
}, },
)) ))

125
voxygen/src/hud/buffs.rs Normal file
View File

@ -0,0 +1,125 @@
use super::{
img_ids::{Imgs, ImgsRot},
TEXT_COLOR,
};
use crate::{
i18n::VoxygenLocalization,
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
GlobalState,
};
use client::Client;
use common::comp::Stats;
use conrod_core::{
color,
widget::{self, Button, Image, Rectangle, Text},
widget_ids, Color, Colorable, Positionable, Sizeable, Widget, WidgetCommon,
};
use inline_tweak::*;
widget_ids! {
struct Ids {
align,
buffs_align,
debuffs_align,
buff_test,
debuff_test,
}
}
#[derive(WidgetCommon)]
pub struct Buffs<'a> {
client: &'a Client,
imgs: &'a Imgs,
fonts: &'a ConrodVoxygenFonts,
#[conrod(common_builder)]
common: widget::CommonBuilder,
global_state: &'a GlobalState,
rot_imgs: &'a ImgsRot,
tooltip_manager: &'a mut TooltipManager,
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
stats: &'a Stats,
}
impl<'a> Buffs<'a> {
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
pub fn new(
client: &'a Client,
imgs: &'a Imgs,
fonts: &'a ConrodVoxygenFonts,
global_state: &'a GlobalState,
rot_imgs: &'a ImgsRot,
tooltip_manager: &'a mut TooltipManager,
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
stats: &'a Stats,
) -> Self {
Self {
client,
imgs,
fonts,
common: widget::CommonBuilder::default(),
global_state,
rot_imgs,
tooltip_manager,
localized_strings,
stats,
}
}
}
pub struct State {
ids: Ids,
}
impl<'a> Widget for Buffs<'a> {
type Event = ();
type State = State;
type Style = ();
fn init_state(&self, id_gen: widget::id::Generator) -> Self::State {
State {
ids: Ids::new(id_gen),
}
}
#[allow(clippy::unused_unit)] // TODO: Pending review in #587
fn style(&self) -> Self::Style { () }
fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event {
let widget::UpdateArgs { state, ui, .. } = args;
let localized_strings = self.localized_strings;
let buffs_tooltip = Tooltip::new({
// Edge images [t, b, r, l]
// Corner images [tr, tl, br, bl]
let edge = &self.rot_imgs.tt_side;
let corner = &self.rot_imgs.tt_corner;
ImageFrame::new(
[edge.cw180, edge.none, edge.cw270, edge.cw90],
[corner.none, corner.cw270, corner.cw90, corner.cw180],
Color::Rgba(0.08, 0.07, 0.04, 1.0),
5.0,
)
})
.title_font_size(self.fonts.cyri.scale(15))
.parent(ui.window)
.desc_font_size(self.fonts.cyri.scale(12))
.font_id(self.fonts.cyri.conrod_id)
.desc_text_color(TEXT_COLOR);
// Alignment
Rectangle::fill_with([484.0, 100.0], color::TRANSPARENT)
.mid_bottom_with_margin_on(ui.window, tweak!(92.0))
.set(state.ids.align, ui);
Rectangle::fill_with([484.0 / 2.0, 90.0], color::TRANSPARENT)
.bottom_left_with_margins_on(state.ids.align, 0.0, 0.0)
.set(state.ids.debuffs_align, ui);
Rectangle::fill_with([484.0 / 2.0, 90.0], color::TRANSPARENT)
.bottom_right_with_margins_on(state.ids.align, 0.0, 0.0)
.set(state.ids.buffs_align, ui);
// Test Widgets
Image::new(self.imgs.debuff_skull_0)
.w_h(20.0, 20.0)
.bottom_right_with_margins_on(state.ids.debuffs_align, 0.0, 1.0)
.set(state.ids.debuff_test, ui);
Image::new(self.imgs.buff_plus_0)
.w_h(20.0, 20.0)
.bottom_left_with_margins_on(state.ids.buffs_align, 0.0, 1.0)
.set(state.ids.buff_test, ui);
}
}

View File

@ -349,6 +349,12 @@ image_ids! {
chat_tell: "voxygen.element.icons.chat.tell", chat_tell: "voxygen.element.icons.chat.tell",
chat_world: "voxygen.element.icons.chat.world", chat_world: "voxygen.element.icons.chat.world",
// Buffs
buff_plus_0: "voxygen.element.de_buffs.buff_plus_0",
// Debuffs
debuff_skull_0: "voxygen.element.de_buffs.debuff_skull_0",
<BlankGraphic> <BlankGraphic>
nothing: (), nothing: (),
} }

View File

@ -1,4 +1,5 @@
mod bag; mod bag;
mod buffs;
mod buttons; mod buttons;
mod chat; mod chat;
mod crafting; mod crafting;
@ -24,6 +25,7 @@ pub use hotbar::{SlotContents as HotbarSlotContents, State as HotbarState};
pub use settings_window::ScaleChange; pub use settings_window::ScaleChange;
use bag::Bag; use bag::Bag;
use buffs::Buffs;
use buttons::Buttons; use buttons::Buttons;
use chat::Chat; use chat::Chat;
use chrono::NaiveTime; use chrono::NaiveTime;
@ -239,6 +241,7 @@ widget_ids! {
spell, spell,
skillbar, skillbar,
buttons, buttons,
buffs,
esc_menu, esc_menu,
small_window, small_window,
social_window, social_window,
@ -1754,6 +1757,24 @@ impl Hud {
} }
} }
// Buffs and Debuffs
if let Some(player_stats) = stats.get(client.entity()) {
match Buffs::new(
client,
&self.imgs,
&self.fonts,
global_state,
&self.rot_imgs,
tooltip_manager,
&self.voxygen_i18n,
&player_stats,
)
.set(self.ids.buffs, ui_widgets)
{
_ => {},
}
}
// Popup (waypoint saved and similar notifications) // Popup (waypoint saved and similar notifications)
Popup::new( Popup::new(
&self.voxygen_i18n, &self.voxygen_i18n,
@ -1848,9 +1869,9 @@ impl Hud {
&stats, &stats,
&loadout, &loadout,
&energy, &energy,
&character_state, //&character_state,
self.pulse, self.pulse,
&controller, //&controller,
&inventory, &inventory,
&self.hotbar, &self.hotbar,
tooltip_manager, tooltip_manager,

View File

@ -1,5 +1,6 @@
use super::{ use super::{
img_ids::Imgs, BarNumbers, CrosshairType, PressBehavior, ShortcutNumbers, Show, CRITICAL_HP_COLOR, ERROR_COLOR, HP_COLOR, LOW_HP_COLOR, MENU_BG, STAMINA_COLOR, img_ids::Imgs, BarNumbers, CrosshairType, PressBehavior, ShortcutNumbers, Show,
CRITICAL_HP_COLOR, ERROR_COLOR, HP_COLOR, LOW_HP_COLOR, MENU_BG, STAMINA_COLOR,
TEXT_BIND_CONFLICT_COLOR, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN, TEXT_BIND_CONFLICT_COLOR, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN,
}; };
use crate::{ use crate::{

View File

@ -2,8 +2,8 @@ use super::{
hotbar, hotbar,
img_ids::{Imgs, ImgsRot}, img_ids::{Imgs, ImgsRot},
item_imgs::ItemImgs, item_imgs::ItemImgs,
slots, BarNumbers, ShortcutNumbers, Show, BLACK, CRITICAL_HP_COLOR, HP_COLOR, slots, BarNumbers, ShortcutNumbers, Show, BLACK, CRITICAL_HP_COLOR, HP_COLOR, LOW_HP_COLOR,
LOW_HP_COLOR, STAMINA_COLOR, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN, XP_COLOR, STAMINA_COLOR, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN, XP_COLOR,
}; };
use crate::{ use crate::{
i18n::VoxygenLocalization, i18n::VoxygenLocalization,
@ -20,7 +20,7 @@ use common::comp::{
tool::{Tool, ToolKind}, tool::{Tool, ToolKind},
Hands, ItemKind, Hands, ItemKind,
}, },
CharacterState, ControllerInputs, Energy, Inventory, Loadout, Stats, Energy, Inventory, Loadout, Stats,
}; };
use conrod_core::{ use conrod_core::{
color, color,
@ -87,7 +87,6 @@ widget_ids! {
slot1, slot1,
slot1_text, slot1_text,
slot1_text_bg, slot1_text_bg,
//slot1_act,
slot2, slot2,
slot2_text, slot2_text,
slot2_text_bg, slot2_text_bg,
@ -128,8 +127,8 @@ pub struct Skillbar<'a> {
stats: &'a Stats, stats: &'a Stats,
loadout: &'a Loadout, loadout: &'a Loadout,
energy: &'a Energy, energy: &'a Energy,
character_state: &'a CharacterState, // character_state: &'a CharacterState,
controller: &'a ControllerInputs, // controller: &'a ControllerInputs,
inventory: &'a Inventory, inventory: &'a Inventory,
hotbar: &'a hotbar::State, hotbar: &'a hotbar::State,
tooltip_manager: &'a mut TooltipManager, tooltip_manager: &'a mut TooltipManager,
@ -152,9 +151,9 @@ impl<'a> Skillbar<'a> {
stats: &'a Stats, stats: &'a Stats,
loadout: &'a Loadout, loadout: &'a Loadout,
energy: &'a Energy, energy: &'a Energy,
character_state: &'a CharacterState, // character_state: &'a CharacterState,
pulse: f32, pulse: f32,
controller: &'a ControllerInputs, // controller: &'a ControllerInputs,
inventory: &'a Inventory, inventory: &'a Inventory,
hotbar: &'a hotbar::State, hotbar: &'a hotbar::State,
tooltip_manager: &'a mut TooltipManager, tooltip_manager: &'a mut TooltipManager,
@ -172,9 +171,9 @@ impl<'a> Skillbar<'a> {
loadout, loadout,
energy, energy,
common: widget::CommonBuilder::default(), common: widget::CommonBuilder::default(),
character_state, // character_state,
pulse, pulse,
controller, // controller,
inventory, inventory,
hotbar, hotbar,
tooltip_manager, tooltip_manager,
@ -210,7 +209,11 @@ impl<'a> Widget for Skillbar<'a> {
fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event { fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event {
let widget::UpdateArgs { state, ui, .. } = args; let widget::UpdateArgs { state, ui, .. } = args;
let level = if self.stats.level.level() > 999 {"A".to_string()} else {(self.stats.level.level()).to_string()}; let level = if self.stats.level.level() > 999 {
"A".to_string()
} else {
(self.stats.level.level()).to_string()
};
let exp_percentage = (self.stats.exp.current() as f64) / (self.stats.exp.maximum() as f64); let exp_percentage = (self.stats.exp.current() as f64) / (self.stats.exp.maximum() as f64);
@ -226,7 +229,6 @@ impl<'a> Widget for Skillbar<'a> {
let bar_values = self.global_state.settings.gameplay.bar_numbers; let bar_values = self.global_state.settings.gameplay.bar_numbers;
let shortcuts = self.global_state.settings.gameplay.shortcut_numbers; let shortcuts = self.global_state.settings.gameplay.shortcut_numbers;
const BG_COLOR_2: Color = Color::Rgba(0.0, 0.0, 0.0, 0.99);
let hp_ani = (self.pulse * 4.0/* speed factor */).cos() * 0.5 + 0.8; //Animation timer let hp_ani = (self.pulse * 4.0/* speed factor */).cos() * 0.5 + 0.8; //Animation timer
let crit_hp_color: Color = Color::Rgba(0.79, 0.19, 0.17, hp_ani); let crit_hp_color: Color = Color::Rgba(0.79, 0.19, 0.17, hp_ani);
@ -357,13 +359,13 @@ impl<'a> Widget for Skillbar<'a> {
.set(state.ids.level, ui); .set(state.ids.level, ui);
// Exp-Bar // Exp-Bar
Rectangle::fill_with([476.0, 8.0], color::TRANSPARENT) Rectangle::fill_with([476.0, 8.0], color::TRANSPARENT)
.mid_bottom_with_margin_on(state.ids.bg, 4.0) .mid_bottom_with_margin_on(state.ids.bg, 4.0)
.set(state.ids.exp_alignment, ui); .set(state.ids.exp_alignment, ui);
Image::new(self.imgs.bar_content) Image::new(self.imgs.bar_content)
.w_h(476.0 * exp_percentage, 8.0) .w_h(476.0 * exp_percentage, 8.0)
.color(Some(XP_COLOR)) .color(Some(XP_COLOR))
.bottom_left_with_margins_on(state.ids.exp_alignment, 0.0, 0.0) .bottom_left_with_margins_on(state.ids.exp_alignment, 0.0, 0.0)
.set(state.ids.exp_filling, ui); .set(state.ids.exp_filling, ui);
// Health and Stamina bar // Health and Stamina bar
// Alignment // Alignment
Rectangle::fill_with([240.0, 17.0], color::TRANSPARENT) Rectangle::fill_with([240.0, 17.0], color::TRANSPARENT)
@ -388,11 +390,11 @@ impl<'a> Widget for Skillbar<'a> {
.color(Some(STAMINA_COLOR)) .color(Some(STAMINA_COLOR))
.top_left_with_margins_on(state.ids.stamina_alignment, 4.0, 0.0) .top_left_with_margins_on(state.ids.stamina_alignment, 4.0, 0.0)
.set(state.ids.stamina_filling, ui); .set(state.ids.stamina_filling, ui);
Rectangle::fill_with([216.0, 14.0], color::TRANSPARENT) Rectangle::fill_with([219.0, 14.0], color::TRANSPARENT)
.top_left_with_margins_on(state.ids.hp_alignment, 4.0, 13.0) .top_left_with_margins_on(state.ids.hp_alignment, 4.0, 20.0)
.set(state.ids.hp_txt_alignment, ui); .set(state.ids.hp_txt_alignment, ui);
Rectangle::fill_with([216.0, 14.0], color::TRANSPARENT) Rectangle::fill_with([219.0, 14.0], color::TRANSPARENT)
.top_right_with_margins_on(state.ids.stamina_alignment, 4.0, 13.0) .top_right_with_margins_on(state.ids.stamina_alignment, 4.0, 20.0)
.set(state.ids.stamina_txt_alignment, ui); .set(state.ids.stamina_txt_alignment, ui);
// Bar Text // Bar Text
// Values // Values
@ -410,25 +412,25 @@ impl<'a> Widget for Skillbar<'a> {
}; };
Text::new(&hp_txt) Text::new(&hp_txt)
.middle_of(state.ids.hp_txt_alignment) .middle_of(state.ids.hp_txt_alignment)
.font_size(self.fonts.cyri.scale(14)) .font_size(self.fonts.cyri.scale(12))
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, 1.0)) .color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
.set(state.ids.hp_txt_bg, ui); .set(state.ids.hp_txt_bg, ui);
Text::new(&hp_txt) Text::new(&hp_txt)
.bottom_left_with_margins_on(state.ids.hp_txt_bg, 2.0, 2.0) .bottom_left_with_margins_on(state.ids.hp_txt_bg, 2.0, 2.0)
.font_size(self.fonts.cyri.scale(14)) .font_size(self.fonts.cyri.scale(12))
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(state.ids.hp_txt, ui); .set(state.ids.hp_txt, ui);
Text::new(&energy_txt) Text::new(&energy_txt)
.middle_of(state.ids.stamina_txt_alignment) .middle_of(state.ids.stamina_txt_alignment)
.font_size(self.fonts.cyri.scale(14)) .font_size(self.fonts.cyri.scale(12))
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, 1.0)) .color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
.set(state.ids.stamina_txt_bg, ui); .set(state.ids.stamina_txt_bg, ui);
Text::new(&energy_txt) Text::new(&energy_txt)
.bottom_left_with_margins_on(state.ids.stamina_txt_bg, 2.0, 2.0) .bottom_left_with_margins_on(state.ids.stamina_txt_bg, 2.0, 2.0)
.font_size(self.fonts.cyri.scale(14)) .font_size(self.fonts.cyri.scale(12))
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(state.ids.stamina_txt, ui); .set(state.ids.stamina_txt, ui);
@ -443,25 +445,25 @@ impl<'a> Widget for Skillbar<'a> {
}; };
Text::new(&hp_txt) Text::new(&hp_txt)
.middle_of(state.ids.hp_txt_alignment) .middle_of(state.ids.hp_txt_alignment)
.font_size(self.fonts.cyri.scale(14)) .font_size(self.fonts.cyri.scale(12))
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, 1.0)) .color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
.set(state.ids.hp_txt_bg, ui); .set(state.ids.hp_txt_bg, ui);
Text::new(&hp_txt) Text::new(&hp_txt)
.bottom_left_with_margins_on(state.ids.hp_txt_bg, 2.0, 2.0) .bottom_left_with_margins_on(state.ids.hp_txt_bg, 2.0, 2.0)
.font_size(self.fonts.cyri.scale(14)) .font_size(self.fonts.cyri.scale(12))
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(state.ids.hp_txt, ui); .set(state.ids.hp_txt, ui);
Text::new(&energy_txt) Text::new(&energy_txt)
.middle_of(state.ids.stamina_txt_alignment) .middle_of(state.ids.stamina_txt_alignment)
.font_size(self.fonts.cyri.scale(14)) .font_size(self.fonts.cyri.scale(12))
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, 1.0)) .color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
.set(state.ids.stamina_txt_bg, ui); .set(state.ids.stamina_txt_bg, ui);
Text::new(&energy_txt) Text::new(&energy_txt)
.bottom_left_with_margins_on(state.ids.stamina_txt_bg, 2.0, 2.0) .bottom_left_with_margins_on(state.ids.stamina_txt_bg, 2.0, 2.0)
.font_size(self.fonts.cyri.scale(14)) .font_size(self.fonts.cyri.scale(12))
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(state.ids.stamina_txt, ui); .set(state.ids.stamina_txt, ui);
@ -607,16 +609,6 @@ impl<'a> Widget for Skillbar<'a> {
// Slot M1 // Slot M1
Image::new(self.imgs.inv_slot) Image::new(self.imgs.inv_slot)
.w_h(40.0, 40.0) .w_h(40.0, 40.0)
.color(
match self.loadout.active_item.as_ref().map(|i| i.item.kind()) {
Some(ItemKind::Tool(Tool { kind, .. })) => match kind {
ToolKind::Bow(_) => Some(BG_COLOR_2),
ToolKind::Staff(_) => Some(BG_COLOR_2),
_ => Some(BG_COLOR_2),
},
_ => Some(BG_COLOR_2),
},
)
.right_from(state.ids.slot5, 0.0) .right_from(state.ids.slot5, 0.0)
.set(state.ids.m1_slot_bg, ui); .set(state.ids.m1_slot_bg, ui);
Button::image( Button::image(
@ -643,33 +635,10 @@ impl<'a> Widget for Skillbar<'a> {
.middle_of(state.ids.m1_slot_bg) .middle_of(state.ids.m1_slot_bg)
.set(state.ids.m1_content, ui); .set(state.ids.m1_content, ui);
// Slot M2 // Slot M2
match self.character_state { Image::new(self.imgs.inv_slot)
CharacterState::BasicMelee { .. } => { .w_h(40.0, 40.0)
let fade_pulse = (self.pulse * 4.0/* speed factor */).cos() * 0.5 + 0.6; //Animation timer; .right_from(state.ids.m1_slot_bg, 0.0)
if self.controller.secondary.is_pressed() { .set(state.ids.m2_slot, ui);
Image::new(self.imgs.inv_slot)
.w_h(40.0, 40.0)
.right_from(state.ids.m1_slot_bg, 0.0)
.set(state.ids.m2_slot, ui);
Image::new(self.imgs.inv_slot)
.w_h(40.0, 40.0)
.middle_of(state.ids.m2_slot)
.color(Some(Color::Rgba(1.0, 1.0, 1.0, fade_pulse)))
.set(state.ids.m2_slot_act, ui);
} else {
Image::new(self.imgs.inv_slot)
.w_h(40.0, 40.0)
.right_from(state.ids.m1_slot_bg, 0.0)
.set(state.ids.m2_slot, ui);
}
},
_ => {
Image::new(self.imgs.inv_slot)
.w_h(40.0, 40.0)
.right_from(state.ids.m1_slot_bg, 0.0)
.set(state.ids.m2_slot, ui);
},
}
let active_tool_kind = match self.loadout.active_item.as_ref().map(|i| i.item.kind()) { let active_tool_kind = match self.loadout.active_item.as_ref().map(|i| i.item.kind()) {
Some(ItemKind::Tool(Tool { kind, .. })) => Some(kind), Some(ItemKind::Tool(Tool { kind, .. })) => Some(kind),
@ -692,11 +661,6 @@ impl<'a> Widget for Skillbar<'a> {
Image::new(self.imgs.inv_slot) Image::new(self.imgs.inv_slot)
.w_h(40.0, 40.0) .w_h(40.0, 40.0)
.color(match tool_kind {
Some(ToolKind::Bow(_)) => Some(BG_COLOR_2),
Some(ToolKind::Staff(_)) => Some(BG_COLOR_2),
_ => Some(BG_COLOR_2),
})
.middle_of(state.ids.m2_slot) .middle_of(state.ids.m2_slot)
.set(state.ids.m2_slot_bg, ui); .set(state.ids.m2_slot_bg, ui);
Button::image(match tool_kind { Button::image(match tool_kind {
@ -717,6 +681,7 @@ impl<'a> Widget for Skillbar<'a> {
.w_h(36.0, 36.0) .w_h(36.0, 36.0)
.middle_of(state.ids.m2_slot_bg) .middle_of(state.ids.m2_slot_bg)
.image_color(match tool_kind { .image_color(match tool_kind {
// TODO Automate this to grey out unavailable M2 skills
Some(ToolKind::Sword(_)) => { Some(ToolKind::Sword(_)) => {
if self.energy.current() as f64 >= 200.0 { if self.energy.current() as f64 >= 200.0 {
Color::Rgba(1.0, 1.0, 1.0, 1.0) Color::Rgba(1.0, 1.0, 1.0, 1.0)
@ -899,7 +864,7 @@ impl<'a> Widget for Skillbar<'a> {
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(state.ids.slot5_text, ui); .set(state.ids.slot5_text, ui);
} }
if let Some(m1) = &self /*if let Some(m1) = &self
.global_state .global_state
.settings .settings
.controls .controls
@ -936,7 +901,7 @@ impl<'a> Widget for Skillbar<'a> {
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(state.ids.m2_text, ui); .set(state.ids.m2_text, ui);
} }*/
if let Some(slot6) = &self if let Some(slot6) = &self
.global_state .global_state
.settings .settings
@ -1036,18 +1001,19 @@ impl<'a> Widget for Skillbar<'a> {
// Frame // Frame
Image::new(self.imgs.skillbar_frame) Image::new(self.imgs.skillbar_frame)
.w_h(524.0, 80.0) .w_h(524.0, 80.0)
.color(Some(UI_MAIN)) .color(Some(UI_HIGHLIGHT_0))
.middle_of(state.ids.bg) .middle_of(state.ids.bg)
.floating(true) .floating(true)
.set(state.ids.frame, ui); .set(state.ids.frame, ui);
// M1 and M2 icons // M1 and M2 icons
// TODO Don't show this if key bindings are changed
Image::new(self.imgs.m1_ico) Image::new(self.imgs.m1_ico)
.w_h(16.0, 18.0) .w_h(16.0, 18.0)
.mid_bottom_with_margin_on(state.ids.m1_content, tweak!(-9.0)) .mid_bottom_with_margin_on(state.ids.m1_content, tweak!(-11.0))
.set(state.ids.m1_ico, ui); .set(state.ids.m1_ico, ui);
Image::new(self.imgs.m2_ico) Image::new(self.imgs.m2_ico)
.w_h(16.0, 18.0) .w_h(16.0, 18.0)
.mid_bottom_with_margin_on(state.ids.m2_content, tweak!(-9.0)) .mid_bottom_with_margin_on(state.ids.m2_content, tweak!(-11.0))
.set(state.ids.m2_ico, ui); .set(state.ids.m2_ico, ui);
// Buffs // Buffs