text and alignment WIP

This commit is contained in:
Monty Marz 2021-10-19 16:15:35 +02:00 committed by Sam
parent a97cc95496
commit 727295aec1
10 changed files with 45 additions and 34 deletions

View File

@ -31,6 +31,8 @@
"hud.crafting.tabs.weapon": "Weapons",
"hud.crafting.tabs.bag": "Bags",
"hud.crafting.tabs.processed_material": "Materials",
"hud.crafting.dismantle_title": "Dismantling",
"hud.crafting.dismantle_explanation" : "Hover items in your bag to see what\nyou can salvage.\n\nDouble-Click them to start dismantling.",
},

View File

@ -35,7 +35,7 @@
"voxel.object.tanning_rack",
(0.0, 0.0, 0.0), (-90.0, 20.0, 0.0), 1.0,
),
Tool("SalvagingBench"): VoxTrans(
Tool("DismantlingBench"): VoxTrans(
"voxel.sprite.salvaging_station.salvaging_station-0",
(0.0, 0.0, 0.0), (-50.0, 40.0, 30.0), 0.9,
),

View File

@ -3216,8 +3216,8 @@ Loom: Some((
],
wind_sway: 0.0,
)),
// SalvagingBench
SalvagingBench: Some((
// DismantlingBench
DismantlingBench: Some((
variations: [
(
model: "voxygen.voxel.sprite.salvaging_station.salvaging_station-0",

View File

@ -261,7 +261,7 @@ impl Block {
| SpriteKind::Forge
| SpriteKind::Loom
| SpriteKind::SpinningWheel
| SpriteKind::SalvagingBench
| SpriteKind::DismantlingBench
| SpriteKind::TanningRack => None,
SpriteKind::EnsnaringVines => Some(0.1),
_ => Some(0.25),

View File

@ -182,7 +182,7 @@ make_case_elim!(
CavernGrassBlueLong = 0x9B,
CavernLillypadBlue = 0x9C,
CavernMycelBlue = 0x9D,
SalvagingBench = 0x9E,
DismantlingBench = 0x9E,
}
);
@ -239,7 +239,7 @@ impl SpriteKind {
SpriteKind::Loom => 1.27,
SpriteKind::Anvil => 1.1,
SpriteKind::CookingPot => 1.36,
SpriteKind::SalvagingBench => 1.18,
SpriteKind::DismantlingBench => 1.18,
// TODO: Find suitable heights.
SpriteKind::BarrelCactus
| SpriteKind::RoundCactus
@ -442,7 +442,7 @@ impl SpriteKind {
| SpriteKind::SpinningWheel
| SpriteKind::TanningRack
| SpriteKind::Loom
| SpriteKind::SalvagingBench
| SpriteKind::DismantlingBench
)
}
}

View File

@ -636,7 +636,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
})
.and_then(|pos| state.terrain().get(pos).ok().copied())
.and_then(|block| block.get_sprite());
if matches!(sprite, Some(SpriteKind::SalvagingBench)) {
if matches!(sprite, Some(SpriteKind::DismantlingBench)) {
recipe::try_salvage(&mut inventory, slot, ability_map, &msm).ok()
} else {
None

View File

@ -73,6 +73,10 @@ widget_ids! {
category_bgs[],
category_tabs[],
category_imgs[],
dismantle_title,
dismantle_img,
dismantle_txt,
dismantle_highlight_txt,
}
}
@ -617,7 +621,7 @@ impl<'a> Widget for Crafting<'a> {
Some(SpriteKind::Loom) => Some("Loom"),
Some(SpriteKind::SpinningWheel) => Some("SpinningWheel"),
Some(SpriteKind::TanningRack) => Some("TanningRack"),
Some(SpriteKind::SalvagingBench) => Some("SalvagingBench"),
Some(SpriteKind::DismantlingBench) => Some("DismantlingBench"),
_ => None,
};
@ -793,7 +797,7 @@ impl<'a> Widget for Crafting<'a> {
Some(SpriteKind::Loom) => "Loom",
Some(SpriteKind::SpinningWheel) => "SpinningWheel",
Some(SpriteKind::TanningRack) => "TanningRack",
Some(SpriteKind::SalvagingBench) => "SalvagingBench",
Some(SpriteKind::DismantlingBench) => "DismantlingBench",
None => "CraftsmanHammer",
_ => "CraftsmanHammer",
};
@ -817,7 +821,7 @@ impl<'a> Widget for Crafting<'a> {
Some(SpriteKind::Loom) => "hud.crafting.loom",
Some(SpriteKind::SpinningWheel) => "hud.crafting.spinning_wheel",
Some(SpriteKind::TanningRack) => "hud.crafting.tanning_rack",
Some(SpriteKind::SalvagingBench) => "hud.crafting.salvaging_station",
Some(SpriteKind::DismantlingBench) => "hud.crafting.salvaging_station",
_ => "",
};
Text::new(self.localized_strings.get(station_name))
@ -953,7 +957,12 @@ impl<'a> Widget for Crafting<'a> {
.w_h(22.0, 22.0)
.middle_of(state.ids.ingredient_frame[i])
.hover_image(self.imgs.wpn_icon_border_mo)
.with_item_tooltip(self.item_tooltip_manager, vec![&*item_def], &None, &item_tooltip)
.with_item_tooltip(
self.item_tooltip_manager,
vec![&*item_def],
&None,
&item_tooltip,
)
.set(state.ids.ingredient_btn[i], ui)
.was_clicked()
{
@ -1023,39 +1032,39 @@ impl<'a> Widget for Crafting<'a> {
}
} else if *sel_crafting_tab == CraftingTab::Dismantle {
// Title
Text::new("Dismantling")
.mid_top_with_margin_on(state.ids.align_ing, -40.0)
Text::new(self.localized_strings.get("hud.crafting.dismantle_title"))
.mid_top_with_margin_on(state.ids.align_ing, 0.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(24))
.color(TEXT_COLOR)
.parent(state.ids.window)
.set(state.ids.title_ing, ui);
.set(state.ids.dismantle_title, ui);
// Bench Icon
let size = 140.0;
Image::new(animate_by_pulse(
&self
.item_imgs
.img_ids_or_not_found_img(Tool("SalvagingBench".to_string())),
.img_ids_or_not_found_img(Tool("DismantlingBench".to_string())),
self.pulse,
))
.w_h(120.0, 120.0)
.mid_top_with_margin_on(state.ids.align_ing, 40.0)
.wh([size; 2])
.mid_top_with_margin_on(state.ids.align_ing, 50.0)
.parent(state.ids.align_ing)
.set(state.ids.output_img_frame, ui);
.set(state.ids.dismantle_img, ui);
// Explanation
Text::new("Explanation goes here")
.mid_bottom_with_margin_on(state.ids.output_img_frame, -40.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
.color(TEXT_COLOR)
.parent(state.ids.window)
.set(state.ids.ingredients_txt, ui);
// Colored Overlays
Text::new(
self.localized_strings
.get("hud.crafting.dismantle_explanation"),
)
.mid_bottom_with_margin_on(state.ids.dismantle_img, -60.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
.color(TEXT_COLOR)
.parent(state.ids.window)
.set(state.ids.dismantle_txt, ui);
}
// Search / Title Recipes

View File

@ -728,7 +728,7 @@ impl Show {
self.selected_crafting_tab(tab);
self.crafting(true);
self.craft_sprite = self.craft_sprite.or(craft_sprite);
self.salvage = matches!(self.craft_sprite, Some((_, SpriteKind::SalvagingBench)))
self.salvage = matches!(self.craft_sprite, Some((_, SpriteKind::DismantlingBench)))
&& matches!(tab, CraftingTab::Dismantle);
}
@ -4083,7 +4083,7 @@ pub fn get_sprite_desc(sprite: SpriteKind, localized_strings: &Localization) ->
SpriteKind::Loom => "hud.crafting.loom",
SpriteKind::SpinningWheel => "hud.crafting.spinning_wheel",
SpriteKind::TanningRack => "hud.crafting.tanning_rack",
SpriteKind::SalvagingBench => "hud.crafting.salvaging_station",
SpriteKind::DismantlingBench => "hud.crafting.salvaging_station",
sprite => return Some(Cow::Owned(format!("{:?}", sprite))),
};
Some(Cow::Borrowed(localized_strings.get(i18n_key)))

View File

@ -135,7 +135,7 @@ impl BlocksOfInterest {
fires.push(pos);
interactables.push((pos, Interaction::Craft(CraftingTab::Food)))
},
Some(SpriteKind::SalvagingBench) => {
Some(SpriteKind::DismantlingBench) => {
fires.push(pos);
interactables.push((pos, Interaction::Craft(CraftingTab::Dismantle)))
},

View File

@ -539,7 +539,7 @@ impl Archetype for House {
9 => SpriteKind::Loom,
10 => SpriteKind::SpinningWheel,
11 => SpriteKind::TanningRack,
12 => SpriteKind::SalvagingBench,
12 => SpriteKind::DismantlingBench,
_ => unreachable!(),
};