translations, fixes

This commit is contained in:
Monty Marz 2020-11-20 15:01:04 +01:00 committed by Joshua Barretto
parent b30dfd1539
commit 099dfc959f
10 changed files with 154 additions and 80 deletions

BIN
assets/voxygen/element/map/castle_bg.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/map/dungeon_bg.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/map/dungeon_bg2.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/map/town_bg.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -400,8 +400,17 @@ magischen Gegenstände ergattern?"#,
"hud.free_look_indicator": "Freie Sicht aktiv",
"hud.auto_walk_indicator": "Automatisches Laufen aktiv",
"hud.map.difficulty": "Schwierigkeit",
"hud.map.towns": "Dörfer",
"hud.map.castles": "Festungen",
"hud.map.dungeons": "Dungeons",
"hud.map.town": "Dorf",
"hud.map.castle": "Festung",
"hud.map.dungeon": "Dungeon",
"hud.map.difficulty_dungeon": "Dungeon\n\nSchwierigkeit: {difficulty}",
"hud.map.drag": "Ziehen",
"hud.map.zoom": "Zoomen",
"hud.map.recenter": "Zurücksetzen",
/// End HUD section
/// Start GameInput section

View File

@ -414,6 +414,18 @@ magically infused items?"#,
"hud.free_look_indicator": "Free look active. Press {key} to disable.",
"hud.auto_walk_indicator": "Auto walk active",
"hud.map.difficulty": "Difficulty",
"hud.map.towns": "Towns",
"hud.map.castles": "Castles",
"hud.map.dungeons": "Dungeons",
"hud.map.town": "Town",
"hud.map.castle": "Castle",
"hud.map.dungeon": "Dungeon",
"hud.map.difficulty_dungeon": "Dungeon\n\nDifficulty: {difficulty}",
"hud.map.drag": "Drag",
"hud.map.zoom": "Zoom",
"hud.map.recenter": "Recenter",
/// End HUD section

View File

@ -203,10 +203,13 @@ image_ids! {
map_dif_5: "voxygen.element.map.dif_5",
mmap_site_town: "voxygen.element.map.town",
mmap_site_town_hover: "voxygen.element.map.town_hover",
mmap_site_town_bg: "voxygen.element.map.town_bg",
mmap_site_dungeon: "voxygen.element.map.dungeon",
mmap_site_dungeon_hover: "voxygen.element.map.dungeon_hover",
mmap_site_dungeon_bg: "voxygen.element.map.dungeon_bg",
mmap_site_castle: "voxygen.element.map.castle",
mmap_site_castle_hover: "voxygen.element.map.castle_hover",
mmap_site_castle_bg: "voxygen.element.map.castle_bg",
// Window Parts
window_3: "voxygen.element.frames.window_3",

View File

@ -143,6 +143,7 @@ impl<'a> Widget for Map<'a> {
let show_dungeons = self.global_state.settings.gameplay.map_show_dungeons;
let show_castles = self.global_state.settings.gameplay.map_show_castles;
let mut events = Vec::new();
let i18n = &self.localized_strings;
// Tooltips
let site_tooltip = Tooltip::new({
// Edge images [t, b, r, l]
@ -191,7 +192,7 @@ impl<'a> Widget for Map<'a> {
.set(state.ids.icon, ui);
// Map Title
Text::new(self.localized_strings.get("hud.map.map_title"))
Text::new(i18n.get("hud.map.map_title"))
.mid_top_with_margin_on(state.ids.frame, 3.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(29))
@ -199,7 +200,7 @@ impl<'a> Widget for Map<'a> {
.set(state.ids.map_title, ui);
// Questlog Title
Text::new(self.localized_strings.get("hud.map.qlog_title"))
Text::new(i18n.get("hud.map.qlog_title"))
.mid_top_with_margin_on(state.ids.qlog_align, 6.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(21))
@ -343,7 +344,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::ShowDifficulties(!show_difficulty));
}
Text::new("Difficulty")
Text::new(i18n.get("hud.map.difficulty"))
.right_from(state.ids.show_difficulty_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -377,7 +378,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::ShowTowns(!show_towns));
}
Text::new("Towns")
Text::new(i18n.get("hud.map.towns"))
.right_from(state.ids.show_towns_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -411,7 +412,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::ShowCastles(!show_castles));
}
Text::new("Castles")
Text::new(i18n.get("hud.map.castles"))
.right_from(state.ids.show_castles_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -445,7 +446,7 @@ impl<'a> Widget for Map<'a> {
{
events.push(Event::ShowDungeons(!show_dungeons));
}
Text::new("Dungeons")
Text::new(i18n.get("hud.map.dungeons"))
.right_from(state.ids.show_dungeons_box, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -484,18 +485,23 @@ impl<'a> Widget for Map<'a> {
{
continue;
}
let title = site.name
.as_ref()
.map(|s| s.as_str())
.unwrap_or_else(|| match &site.kind {
SiteKind::Town => "Town",
SiteKind::Dungeon { .. } => "Dungeon",
SiteKind::Castle => "Castle",
});
let title =
site.name
.as_ref()
.map(|s| s.as_str())
.unwrap_or_else(|| match &site.kind {
SiteKind::Town => i18n.get("hud.map.town"),
SiteKind::Dungeon { .. } => i18n.get("hud.map.dungeon"),
SiteKind::Castle => i18n.get("hud.map.castle"),
});
let (difficulty, desc) = match &site.kind {
SiteKind::Town => (0, "Town".to_string()),
SiteKind::Dungeon { difficulty } => (*difficulty, format!("Dungeon, difficulty {}", difficulty)),
SiteKind::Castle => (0, "Castle".to_string()),
SiteKind::Town => (0, i18n.get("hud.map.town").to_string()),
SiteKind::Dungeon { difficulty } => (
*difficulty,
i18n.get("hud.map.difficulty_dungeon")
.replace("{difficulty}", difficulty.to_string().as_str()),
),
SiteKind::Castle => (0, i18n.get("hud.map.castle").to_string()),
};
let site_btn = Button::image(match &site.kind {
SiteKind::Town => {
@ -538,14 +544,18 @@ impl<'a> Widget for Map<'a> {
title,
&desc,
&site_tooltip,
match difficulty {
1 => QUALITY_LOW,
2 => QUALITY_COMMON,
3 => QUALITY_MODERATE,
4 => QUALITY_HIGH,
5 => QUALITY_EPIC,
6 => QUALITY_DEBUG,
_ => TEXT_COLOR,
match &site.kind {
SiteKind::Town => TEXT_COLOR,
SiteKind::Castle => TEXT_COLOR,
SiteKind::Dungeon { .. } => match difficulty {
0 => QUALITY_LOW,
1 => QUALITY_COMMON,
2 => QUALITY_MODERATE,
3 => QUALITY_HIGH,
4 => QUALITY_EPIC,
5 => QUALITY_DEBUG,
_ => TEXT_COLOR,
},
},
);
// Only display sites that are toggled on
@ -572,33 +582,33 @@ impl<'a> Widget for Map<'a> {
if show_difficulty {
let size = 1.8; // Size factor for difficulty indicators
let dif_img = Image::new(match difficulty {
1 => self.imgs.map_dif_0,
2 => self.imgs.map_dif_1,
3 => self.imgs.map_dif_2,
4 => self.imgs.map_dif_3,
5 => self.imgs.map_dif_4,
6 => self.imgs.map_dif_5,
0 => self.imgs.map_dif_0,
1 => self.imgs.map_dif_1,
2 => self.imgs.map_dif_2,
3 => self.imgs.map_dif_3,
4 => self.imgs.map_dif_4,
5 => self.imgs.map_dif_5,
_ => self.imgs.nothing,
})
.mid_top_with_margin_on(state.ids.mmap_site_icons[i], match difficulty {
6 => -12.0 * size,
5 => -12.0 * size,
_ => -4.0 * size,
})
.w(match difficulty {
6 => 12.0 * size,
5 => 12.0 * size,
_ => 4.0 * size * difficulty as f64,
})
.h(match difficulty {
6 => 12.0 * size,
5 => 12.0 * size,
_ => 4.0 * size,
})
.color(Some(match difficulty {
1 => QUALITY_LOW,
2 => QUALITY_COMMON,
3 => QUALITY_MODERATE,
4 => QUALITY_HIGH,
5 => QUALITY_EPIC,
6 => TEXT_COLOR,
0 => QUALITY_LOW,
1 => QUALITY_COMMON,
2 => QUALITY_MODERATE,
3 => QUALITY_HIGH,
4 => QUALITY_EPIC,
5 => QUALITY_DEBUG,
_ => TEXT_COLOR,
}));
match &site.kind {
@ -672,7 +682,7 @@ impl<'a> Widget for Map<'a> {
} else {
self.imgs.button
})
.label("Recenter")
.label(i18n.get("hud.map.recenter"))
.label_y(conrod_core::position::Relative::Scalar(1.0))
.label_color(if recenter {
TEXT_COLOR
@ -697,7 +707,7 @@ impl<'a> Widget for Map<'a> {
.w_h(icon_size.x, icon_size.y)
.color(Some(UI_HIGHLIGHT_0))
.set(state.ids.drag_ico, ui);
Text::new("Drag")
Text::new(i18n.get("hud.map.drag"))
.right_from(state.ids.drag_ico, tweak!(5.0))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -709,7 +719,7 @@ impl<'a> Widget for Map<'a> {
.w_h(icon_size.x, icon_size.y)
.color(Some(UI_HIGHLIGHT_0))
.set(state.ids.zoom_ico, ui);
Text::new("Zoom")
Text::new(i18n.get("hud.map.zoom"))
.right_from(state.ids.zoom_ico, tweak!(5.0))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)

View File

@ -1,7 +1,7 @@
use super::{
img_ids::{Imgs, ImgsRot},
Show, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN,
};
Show, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN, QUALITY_COMMON, QUALITY_DEBUG, QUALITY_EPIC, QUALITY_HIGH, QUALITY_LOW, QUALITY_MODERATE,
};
use crate::ui::{fonts::Fonts, img_ids};
use client::{self, Client};
use common::{comp, msg::world_msg::SiteKind, terrain::TerrainChunkSize, vol::RectVolSize};
@ -10,7 +10,7 @@ use conrod_core::{
widget::{self, Button, Image, Rectangle, Text},
widget_ids, Color, Colorable, Positionable, Sizeable, Widget, WidgetCommon,
};
use inline_tweak::*;
use specs::WorldExt;
use vek::*;
@ -29,6 +29,7 @@ widget_ids! {
mmap_east,
mmap_south,
mmap_west,
mmap_site_icons_bgs[],
mmap_site_icons[],
}
}
@ -233,7 +234,15 @@ impl<'a> Widget for MiniMap<'a> {
.resize(self.client.sites().len(), &mut ui.widget_id_generator())
});
}
for (i, site) in self.client.sites().iter().enumerate() {
if state.ids.mmap_site_icons_bgs.len() < self.client.sites().len() {
state.update(|state| {
state
.ids
.mmap_site_icons_bgs
.resize(self.client.sites().len(), &mut ui.widget_id_generator())
});
}
for (i, site) in self.client.sites().iter().enumerate() {
let rwpos = site.wpos.map(|e| e as f32) - player_pos;
let rcpos = rwpos.map2(TerrainChunkSize::RECT_SIZE, |e, sz| e / sz as f32)
* state.zoom as f32
@ -251,19 +260,42 @@ impl<'a> Widget for MiniMap<'a> {
}
Image::new(match &site.kind {
SiteKind::Town => self.imgs.mmap_site_town,
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon,
SiteKind::Castle => self.imgs.mmap_site_castle,
SiteKind::Town => self.imgs.mmap_site_town_bg,
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon_bg,
SiteKind::Castle => self.imgs.mmap_site_castle_bg,
})
.x_y_position_relative_to(
state.ids.grid,
position::Relative::Scalar(rpos.x as f64),
position::Relative::Scalar(rpos.y as f64),
)
.w_h(20.0 * tweak!(1.0), 20.0 * tweak!(1.0))
.color(Some(UI_HIGHLIGHT_0))
.w_h(20.0, 20.0)
.color(Some(
match &site.kind {
SiteKind::Town => Color::Rgba(1.0, 1.0, 1.0, 0.0),
SiteKind::Castle => Color::Rgba(1.0, 1.0, 1.0, 0.0),
SiteKind::Dungeon { difficulty } => match difficulty {
0 => QUALITY_LOW,
1 => QUALITY_COMMON,
2 => QUALITY_MODERATE,
3 => QUALITY_HIGH,
4 => QUALITY_EPIC,
5 => QUALITY_DEBUG,
_ => Color::Rgba(1.0, 1.0, 1.0, 0.0),
},
},))
.floating(true)
.parent(ui.window)
.set(state.ids.mmap_site_icons_bgs[i], ui);
Image::new(match &site.kind {
SiteKind::Town => self.imgs.mmap_site_town,
SiteKind::Dungeon { .. } => self.imgs.mmap_site_dungeon,
SiteKind::Castle => self.imgs.mmap_site_castle,
})
.middle_of(state.ids.mmap_site_icons_bgs[i])
.w_h(20.0, 20.0)
.color(Some(UI_HIGHLIGHT_0))
.floating(true)
.set(state.ids.mmap_site_icons[i], ui);
}
@ -331,26 +363,25 @@ impl<'a> Widget for MiniMap<'a> {
// TODO: Subregion name display
// Title
match self.client.current_chunk() {
Some(chunk) =>
{
// Count characters in the name to avoid clipping with the name display
let name_len = chunk.meta().name().chars().count();
Text::new(chunk.meta().name())
.mid_top_with_margin_on(state.ids.mmap_frame, match name_len {
16..=30 => 4.0,
_ => 2.0,
})
.font_size(self.fonts.cyri.scale(
match name_len {
match self.client.current_chunk() {
Some(chunk) => {
// Count characters in the name to avoid clipping with the name display
let name_len = chunk.meta().name().chars().count();
Text::new(chunk.meta().name())
.mid_top_with_margin_on(state.ids.mmap_frame, match name_len {
16..=30 => 4.0,
_ => 2.0,
})
.font_size(self.fonts.cyri.scale(match name_len {
0..=16 => 18,
16..=30 => 14,
_ => 14,
}))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.mmap_location, ui)},
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.mmap_location, ui)
},
None => Text::new(" ")
.mid_top_with_margin_on(state.ids.mmap_frame, 0.0)
.font_size(self.fonts.cyri.scale(18))

View File

@ -49,8 +49,6 @@ use crate::{
i18n::{i18n_asset_key, LanguageMetadata, Localization},
render::{Consts, Globals, RenderMode, Renderer},
scene::camera::{self, Camera},
ui::{fonts::Fonts, img_ids::Rotations, slot, Graphic, Ingameable, ScaleMode, Ui},
window::{Event as WinEvent, FullScreenSettings, GameInput},
GlobalState,
@ -67,9 +65,9 @@ use common::{
span,
sync::Uid,
terrain::TerrainChunk,
util::srgba_to_linear,
vol::RectRasterableVol,
};
use common::util::srgba_to_linear;
use conrod_core::{
text::cursor::Index,
widget::{self, Button, Image, Text},
@ -455,7 +453,7 @@ pub struct Show {
want_grab: bool,
stats: bool,
free_look: bool,
auto_walk: bool,
auto_walk: bool,
}
impl Show {
fn bag(&mut self, open: bool) {
@ -717,7 +715,7 @@ impl Hud {
ingame: true,
stats: false,
free_look: false,
auto_walk: false,
auto_walk: false,
},
to_focus: None,
//never_show: false,
@ -2250,7 +2248,7 @@ impl Hud {
}
// Map
if self.show.map {
for event in Map::new(
for event in Map::new(
client,
&self.imgs,
&self.rot_imgs,
@ -2289,13 +2287,12 @@ impl Hud {
},
}
}
}
else {
} else {
// Reset the map position when it's not showing
let drag = &global_state.settings.gameplay.map_drag;
let drag = &global_state.settings.gameplay.map_drag;
if drag.x != 0.0 || drag.y != 0.0 {
events.push(Event::MapDrag(drag - drag))
}
}
}
if self.show.esc_menu {