slot kinds

This commit is contained in:
Pfauenauge90 2020-04-06 23:16:24 +02:00
parent f5a768dccf
commit fa03f9ddb9
3 changed files with 25 additions and 18 deletions

View File

@ -67,8 +67,8 @@ widget_ids! {
hands_slot,
legs_slot,
belt_slot,
ring_r_slot,
ring_l_slot,
lantern_slot,
ring_slot,
feet_slot,
back_slot,
tabard_slot,
@ -404,27 +404,27 @@ impl<'a> Widget for Bag<'a> {
.with_icon(self.imgs.legs_bg, Vec2::new(48.0, 70.0), Some(UI_MAIN))
.with_tooltip(self.tooltip_manager, title, desc, &item_tooltip)
.set(state.ids.legs_slot, ui);
// Ring-L
let (title, desc) = ("Left Ring", "");
// Lantern
let (title, desc) = ("Lantern", "");
slot_maker
.fabricate(ArmorSlot::LeftRing, [45.0; 2])
.fabricate(ArmorSlot::Lantern, [45.0; 2])
.bottom_right_with_margins_on(state.ids.shoulders_slot, -55.0, 0.0)
.with_icon(self.imgs.ring_l_bg, Vec2::new(36.0, 40.0), Some(UI_MAIN))
.with_icon(self.imgs.lantern_bg, Vec2::new(24.0, 38.0), Some(UI_MAIN))
.with_tooltip(self.tooltip_manager, title, desc, &item_tooltip)
.set(state.ids.ring_l_slot, ui);
// Ring-R
let (title, desc) = ("Right Ring", "");
.set(state.ids.lantern_slot, ui);
// Ring
let (title, desc) = ("Ring", "");
slot_maker
.fabricate(ArmorSlot::RightRing, [45.0; 2])
.fabricate(ArmorSlot::Ring, [45.0; 2])
.bottom_left_with_margins_on(state.ids.hands_slot, -55.0, 0.0)
.with_icon(self.imgs.ring_r_bg, Vec2::new(36.0, 40.0), Some(UI_MAIN))
.with_icon(self.imgs.ring_bg, Vec2::new(36.0, 40.0), Some(UI_MAIN))
.with_tooltip(self.tooltip_manager, title, desc, &item_tooltip)
.set(state.ids.ring_r_slot, ui);
.set(state.ids.ring_slot, ui);
// Back
let (title, desc) = ("Back", "");
slot_maker
.fabricate(ArmorSlot::Back, [45.0; 2])
.down_from(state.ids.ring_l_slot, 10.0)
.down_from(state.ids.lantern_slot, 10.0)
.with_icon(self.imgs.back_bg, Vec2::new(33.0, 40.0), Some(UI_MAIN))
.with_tooltip(self.tooltip_manager, title, desc, &item_tooltip)
.set(state.ids.back_slot, ui);
@ -435,7 +435,7 @@ impl<'a> Widget for Bag<'a> {
.map_or(("Feet", ""), |item| (item.name(), item.description()));
slot_maker
.fabricate(ArmorSlot::Feet, [45.0; 2])
.down_from(state.ids.ring_r_slot, 10.0)
.down_from(state.ids.ring_slot, 10.0)
.with_icon(self.imgs.feet_bg, Vec2::new(32.0, 40.0), Some(UI_MAIN))
.with_tooltip(self.tooltip_manager, title, desc, &item_tooltip)
.set(state.ids.feet_slot, ui);

View File

@ -238,11 +238,11 @@ image_ids! {
belt_bg: "voxygen.element.icons.belt",
legs_bg: "voxygen.element.icons.legs",
feet_bg: "voxygen.element.icons.feet",
ring_r_bg: "voxygen.element.icons.ring",
ring_l_bg: "voxygen.element.icons.ring",
ring_bg: "voxygen.element.icons.ring",
tabard_bg: "voxygen.element.icons.tabard",
chest_bg: "voxygen.element.icons.chest",
back_bg: "voxygen.element.icons.back",
lantern_bg: "voxygen.element.icons.lantern",
necklace_bg: "voxygen.element.icons.necklace",
mainhand_bg: "voxygen.element.icons.mainhand",
offhand_bg: "voxygen.element.icons.offhand",

View File

@ -8,6 +8,7 @@ pub enum HudSlotKinds {
Inventory(InventorySlot),
Armor(ArmorSlot),
Hotbar(HotbarSlot),
//Spellbook(SpellbookSlot), TODO
}
pub type HudSlotManager = SlotManager<HudSlotKinds>;
@ -22,8 +23,8 @@ pub enum ArmorSlot {
Shoulders,
Chest,
Hands,
LeftRing,
RightRing,
Ring,
Lantern,
Back,
Belt,
Legs,
@ -86,6 +87,12 @@ impl ContentKey for ArmorSlot {
ArmorSlot::Hands => source.hand.as_ref(),
ArmorSlot::Legs => source.pants.as_ref(),
ArmorSlot::Feet => source.foot.as_ref(),
ArmorSlot::Back => source.back.as_ref(),
ArmorSlot::Ring => source.ring.as_ref(),
ArmorSlot::Neck => source.neck.as_ref(),
ArmorSlot::Head => source.head.as_ref(),
ArmorSlot::Lantern => source.lantern.as_ref(),
ArmorSlot::Tabard => source.tabard.as_ref(),
ArmorSlot::Mainhand => source.active_item.as_ref().map(|i| &i.item),
ArmorSlot::Offhand => source.second_item.as_ref().map(|i| &i.item),
_ => None,