mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Rename localization/font types (e.g. VoxygenLocalization -> Localization)
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1864,7 +1864,7 @@ checksum = "5fca6f9d679bff1322c76c9a1ad4b8553b30a94f3f75bea6936e19032c2f2ec3"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"glyph_brush_layout",
|
"glyph_brush_layout",
|
||||||
"log",
|
"log",
|
||||||
"ordered-float",
|
"ordered-float 1.1.0",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"rusttype 0.8.3",
|
"rusttype 0.8.3",
|
||||||
"twox-hash",
|
"twox-hash",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// Localization for Polish / Tłumaczenia dla języka polskiego
|
/// Localization for Polish / Tłumaczenia dla języka polskiego
|
||||||
VoxygenLocalization(
|
Localization(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Polish",
|
language_name: "Polish",
|
||||||
language_identifier: "PL",
|
language_identifier: "PL",
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
/// `assets/voxygen/i18n` and that's it!
|
/// `assets/voxygen/i18n` and that's it!
|
||||||
|
|
||||||
/// Lokalisation für Deutsch/Deutschland
|
/// Lokalisation für Deutsch/Deutschland
|
||||||
VoxygenLocalization(
|
(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Deutsch",
|
language_name: "Deutsch",
|
||||||
language_identifier: "de_DE",
|
language_identifier: "de_DE",
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
/// WARNING: Localization files shall be saved in UTF-8 format without BOM
|
/// WARNING: Localization files shall be saved in UTF-8 format without BOM
|
||||||
|
|
||||||
/// Localization for "global" English
|
/// Localization for "global" English
|
||||||
VoxygenLocalization(
|
(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "English",
|
language_name: "English",
|
||||||
language_identifier: "en",
|
language_identifier: "en",
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
///
|
///
|
||||||
/// Localization for Spanish (Spain)
|
/// Localization for Spanish (Spain)
|
||||||
|
|
||||||
VoxygenLocalization(
|
Localization(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Español de España",
|
language_name: "Español de España",
|
||||||
language_identifier: "es_ES",
|
language_identifier: "es_ES",
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
/// WARNING: Localization files shall be saved in UTF-8 format without BOM
|
/// WARNING: Localization files shall be saved in UTF-8 format without BOM
|
||||||
|
|
||||||
/// Localization for "latinoamericano" Latin-American
|
/// Localization for "latinoamericano" Latin-American
|
||||||
VoxygenLocalization(
|
Localization(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Español Latino",
|
language_name: "Español Latino",
|
||||||
language_identifier: "es_la",
|
language_identifier: "es_la",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// Localization for French (France locale)
|
/// Localization for French (France locale)
|
||||||
VoxygenLocalization(
|
(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Français",
|
language_name: "Français",
|
||||||
language_identifier: "fr_FR",
|
language_identifier: "fr_FR",
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/// Localization for "global" Italian
|
/// Localization for "global" Italian
|
||||||
VoxygenLocalization(
|
(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Italiano",
|
language_name: "Italiano",
|
||||||
language_identifier: "it_IT",
|
language_identifier: "it_IT",
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
/// WARNING: Localization files shall be saved in UTF-8 format without BOM
|
/// WARNING: Localization files shall be saved in UTF-8 format without BOM
|
||||||
|
|
||||||
/// Localization for "global" English
|
/// Localization for "global" English
|
||||||
VoxygenLocalization(
|
(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Nederlands",
|
language_name: "Nederlands",
|
||||||
language_identifier: "nl",
|
language_identifier: "nl",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// Localization for Portuguese (Brazil)
|
/// Localization for Portuguese (Brazil)
|
||||||
VoxygenLocalization(
|
Localization(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Português Brasileiro",
|
language_name: "Português Brasileiro",
|
||||||
language_identifier: "pt_BR",
|
language_identifier: "pt_BR",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// Localization for portuguese (Portugal)
|
/// Localization for portuguese (Portugal)
|
||||||
VoxygenLocalization(
|
(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Português",
|
language_name: "Português",
|
||||||
language_identifier: "pt_PT",
|
language_identifier: "pt_PT",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// Localization for "global" Russian
|
/// Localization for "global" Russian
|
||||||
VoxygenLocalization(
|
(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Русский",
|
language_name: "Русский",
|
||||||
language_identifier: "ru_RU",
|
language_identifier: "ru_RU",
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
/// `assets/voxygen/i18n` and that's it!
|
/// `assets/voxygen/i18n` and that's it!
|
||||||
|
|
||||||
/// Localization for Swedish
|
/// Localization for Swedish
|
||||||
VoxygenLocalization(
|
Localization(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Svenska",
|
language_name: "Svenska",
|
||||||
language_identifier: "sv",
|
language_identifier: "sv",
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
/// WARNING: Localization files shall be saved in UTF-8 format without BOM
|
/// WARNING: Localization files shall be saved in UTF-8 format without BOM
|
||||||
|
|
||||||
/// Localization for Turkish (Turkey)
|
/// Localization for Turkish (Turkey)
|
||||||
VoxygenLocalization(
|
(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Türkçe (Türkiye)",
|
language_name: "Türkçe (Türkiye)",
|
||||||
language_identifier: "tr_TR",
|
language_identifier: "tr_TR",
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
/// 注意: 本地化文件应以 UTF-8无BOM 格式保存
|
/// 注意: 本地化文件应以 UTF-8无BOM 格式保存
|
||||||
|
|
||||||
/// "全局"本地化 Simplified Chinese-简体中文
|
/// "全局"本地化 Simplified Chinese-简体中文
|
||||||
VoxygenLocalization(
|
Localization(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "Simplified Chinese",
|
language_name: "Simplified Chinese",
|
||||||
language_identifier: "zh_CN",
|
language_identifier: "zh_CN",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/// Localization for Traditional Chinese
|
/// Localization for Traditional Chinese
|
||||||
VoxygenLocalization(
|
Localization(
|
||||||
metadata: (
|
metadata: (
|
||||||
language_name: "繁體中文",
|
language_name: "繁體中文",
|
||||||
language_identifier: "zh_TW",
|
language_identifier: "zh_TW",
|
||||||
|
@ -8,9 +8,9 @@ use super::{
|
|||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
hud::get_quality_col,
|
hud::get_quality_col,
|
||||||
i18n::VoxygenLocalization,
|
i18n::Localization,
|
||||||
ui::{
|
ui::{
|
||||||
fonts::ConrodVoxygenFonts,
|
fonts::Fonts,
|
||||||
slot::{ContentSize, SlotMaker},
|
slot::{ContentSize, SlotMaker},
|
||||||
ImageFrame, Tooltip, TooltipManager, Tooltipable,
|
ImageFrame, Tooltip, TooltipManager, Tooltipable,
|
||||||
},
|
},
|
||||||
@ -90,14 +90,14 @@ pub struct Bag<'a> {
|
|||||||
client: &'a Client,
|
client: &'a Client,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
item_imgs: &'a ItemImgs,
|
item_imgs: &'a ItemImgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
slot_manager: &'a mut SlotManager,
|
slot_manager: &'a mut SlotManager,
|
||||||
_pulse: f32,
|
_pulse: f32,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
|
|
||||||
stats: &'a Stats,
|
stats: &'a Stats,
|
||||||
show: &'a Show,
|
show: &'a Show,
|
||||||
@ -109,12 +109,12 @@ impl<'a> Bag<'a> {
|
|||||||
client: &'a Client,
|
client: &'a Client,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
item_imgs: &'a ItemImgs,
|
item_imgs: &'a ItemImgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
slot_manager: &'a mut SlotManager,
|
slot_manager: &'a mut SlotManager,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
stats: &'a Stats,
|
stats: &'a Stats,
|
||||||
show: &'a Show,
|
show: &'a Show,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
@ -4,8 +4,8 @@ use super::{
|
|||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
hud::{get_buff_info, BuffPosition},
|
hud::{get_buff_info, BuffPosition},
|
||||||
i18n::VoxygenLocalization,
|
i18n::Localization,
|
||||||
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||||
GlobalState,
|
GlobalState,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -34,12 +34,12 @@ widget_ids! {
|
|||||||
#[derive(WidgetCommon)]
|
#[derive(WidgetCommon)]
|
||||||
pub struct BuffsBar<'a> {
|
pub struct BuffsBar<'a> {
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
buffs: &'a Buffs,
|
buffs: &'a Buffs,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
@ -49,10 +49,10 @@ impl<'a> BuffsBar<'a> {
|
|||||||
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
|
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
|
||||||
pub fn new(
|
pub fn new(
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
buffs: &'a Buffs,
|
buffs: &'a Buffs,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
|
@ -3,8 +3,8 @@ use super::{
|
|||||||
BLACK, CRITICAL_HP_COLOR, LOW_HP_COLOR, TEXT_COLOR,
|
BLACK, CRITICAL_HP_COLOR, LOW_HP_COLOR, TEXT_COLOR,
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
i18n::VoxygenLocalization,
|
i18n::Localization,
|
||||||
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||||
window::GameInput,
|
window::GameInput,
|
||||||
GlobalState,
|
GlobalState,
|
||||||
};
|
};
|
||||||
@ -49,13 +49,13 @@ pub struct Buttons<'a> {
|
|||||||
client: &'a Client,
|
client: &'a Client,
|
||||||
show_bag: bool,
|
show_bag: bool,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
stats: &'a Stats,
|
stats: &'a Stats,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,11 +65,11 @@ impl<'a> Buttons<'a> {
|
|||||||
client: &'a Client,
|
client: &'a Client,
|
||||||
show_bag: bool,
|
show_bag: bool,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
stats: &'a Stats,
|
stats: &'a Stats,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
img_ids::Imgs, ERROR_COLOR, FACTION_COLOR, GROUP_COLOR, INFO_COLOR, KILL_COLOR, LOOT_COLOR,
|
img_ids::Imgs, ERROR_COLOR, FACTION_COLOR, GROUP_COLOR, INFO_COLOR, KILL_COLOR, LOOT_COLOR,
|
||||||
OFFLINE_COLOR, ONLINE_COLOR, REGION_COLOR, SAY_COLOR, TELL_COLOR, TEXT_COLOR, WORLD_COLOR,
|
OFFLINE_COLOR, ONLINE_COLOR, REGION_COLOR, SAY_COLOR, TELL_COLOR, TEXT_COLOR, WORLD_COLOR,
|
||||||
};
|
};
|
||||||
use crate::{i18n::VoxygenLocalization, ui::fonts::ConrodVoxygenFonts, GlobalState};
|
use crate::{ui::fonts::Fonts, GlobalState, Localization};
|
||||||
use client::{cmd, Client};
|
use client::{cmd, Client};
|
||||||
use common::{
|
use common::{
|
||||||
comp::{
|
comp::{
|
||||||
@ -52,7 +52,7 @@ pub struct Chat<'a> {
|
|||||||
|
|
||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
|
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
@ -60,7 +60,7 @@ pub struct Chat<'a> {
|
|||||||
// TODO: add an option to adjust this
|
// TODO: add an option to adjust this
|
||||||
history_max: usize,
|
history_max: usize,
|
||||||
|
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Chat<'a> {
|
impl<'a> Chat<'a> {
|
||||||
@ -69,8 +69,8 @@ impl<'a> Chat<'a> {
|
|||||||
client: &'a Client,
|
client: &'a Client,
|
||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
new_messages,
|
new_messages,
|
||||||
@ -536,12 +536,7 @@ fn do_tab_completion(cursor: usize, input: &str, word: &str) -> (String, usize)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cursor_offset_to_index(
|
fn cursor_offset_to_index(offset: usize, text: &str, ui: &Ui, fonts: &Fonts) -> Option<Index> {
|
||||||
offset: usize,
|
|
||||||
text: &str,
|
|
||||||
ui: &Ui,
|
|
||||||
fonts: &ConrodVoxygenFonts,
|
|
||||||
) -> Option<Index> {
|
|
||||||
// This moves the cursor to the given offset. Conrod is a pain.
|
// This moves the cursor to the given offset. Conrod is a pain.
|
||||||
//
|
//
|
||||||
// Width and font must match that of the chat TextEdit
|
// Width and font must match that of the chat TextEdit
|
||||||
|
@ -5,8 +5,8 @@ use super::{
|
|||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
hud::get_quality_col,
|
hud::get_quality_col,
|
||||||
i18n::VoxygenLocalization,
|
i18n::Localization,
|
||||||
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||||
};
|
};
|
||||||
use client::{self, Client};
|
use client::{self, Client};
|
||||||
use common::comp::{
|
use common::comp::{
|
||||||
@ -55,8 +55,8 @@ pub enum Event {
|
|||||||
pub struct Crafting<'a> {
|
pub struct Crafting<'a> {
|
||||||
client: &'a Client,
|
client: &'a Client,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
item_imgs: &'a ItemImgs,
|
item_imgs: &'a ItemImgs,
|
||||||
@ -69,8 +69,8 @@ impl<'a> Crafting<'a> {
|
|||||||
pub fn new(
|
pub fn new(
|
||||||
client: &'a Client,
|
client: &'a Client,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
item_imgs: &'a ItemImgs,
|
item_imgs: &'a ItemImgs,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::{img_ids::Imgs, settings_window::SettingsTab, TEXT_COLOR};
|
use super::{img_ids::Imgs, settings_window::SettingsTab, TEXT_COLOR};
|
||||||
use crate::{i18n::VoxygenLocalization, ui::fonts::ConrodVoxygenFonts};
|
use crate::{i18n::Localization, ui::fonts::Fonts};
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
widget::{self, Button, Image},
|
widget::{self, Button, Image},
|
||||||
widget_ids, Color, Labelable, Positionable, Sizeable, Widget, WidgetCommon,
|
widget_ids, Color, Labelable, Positionable, Sizeable, Widget, WidgetCommon,
|
||||||
@ -22,19 +22,15 @@ widget_ids! {
|
|||||||
#[derive(WidgetCommon)]
|
#[derive(WidgetCommon)]
|
||||||
pub struct EscMenu<'a> {
|
pub struct EscMenu<'a> {
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
|
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> EscMenu<'a> {
|
impl<'a> EscMenu<'a> {
|
||||||
pub fn new(
|
pub fn new(imgs: &'a Imgs, fonts: &'a Fonts, localized_strings: &'a Localization) -> Self {
|
||||||
imgs: &'a Imgs,
|
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
|
||||||
) -> Self {
|
|
||||||
Self {
|
Self {
|
||||||
imgs,
|
imgs,
|
||||||
fonts,
|
fonts,
|
||||||
|
@ -6,9 +6,9 @@ use super::{
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
hud::get_buff_info,
|
hud::get_buff_info,
|
||||||
i18n::VoxygenLocalization,
|
i18n::Localization,
|
||||||
settings::Settings,
|
settings::Settings,
|
||||||
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||||
window::GameInput,
|
window::GameInput,
|
||||||
GlobalState,
|
GlobalState,
|
||||||
};
|
};
|
||||||
@ -70,8 +70,8 @@ pub struct Group<'a> {
|
|||||||
settings: &'a Settings,
|
settings: &'a Settings,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
@ -88,8 +88,8 @@ impl<'a> Group<'a> {
|
|||||||
settings: &'a Settings,
|
settings: &'a Settings,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
|
@ -3,8 +3,8 @@ use super::{
|
|||||||
Show, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN,
|
Show, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN,
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
i18n::VoxygenLocalization,
|
i18n::Localization,
|
||||||
ui::{fonts::ConrodVoxygenFonts, img_ids, ImageSlider},
|
ui::{fonts::Fonts, img_ids, ImageSlider},
|
||||||
GlobalState,
|
GlobalState,
|
||||||
};
|
};
|
||||||
use client::{self, Client};
|
use client::{self, Client};
|
||||||
@ -41,11 +41,11 @@ pub struct Map<'a> {
|
|||||||
world_map: &'a (img_ids::Rotations, Vec2<u32>),
|
world_map: &'a (img_ids::Rotations, Vec2<u32>),
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
_pulse: f32,
|
_pulse: f32,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
}
|
}
|
||||||
impl<'a> Map<'a> {
|
impl<'a> Map<'a> {
|
||||||
@ -56,9 +56,9 @@ impl<'a> Map<'a> {
|
|||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
world_map: &'a (img_ids::Rotations, Vec2<u32>),
|
world_map: &'a (img_ids::Rotations, Vec2<u32>),
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
img_ids::{Imgs, ImgsRot},
|
img_ids::{Imgs, ImgsRot},
|
||||||
Show, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN,
|
Show, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN,
|
||||||
};
|
};
|
||||||
use crate::ui::{fonts::ConrodVoxygenFonts, img_ids};
|
use crate::ui::{fonts::Fonts, img_ids};
|
||||||
use client::{self, Client};
|
use client::{self, Client};
|
||||||
use common::{comp, terrain::TerrainChunkSize, vol::RectVolSize};
|
use common::{comp, terrain::TerrainChunkSize, vol::RectVolSize};
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
@ -40,7 +40,7 @@ pub struct MiniMap<'a> {
|
|||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
world_map: &'a (img_ids::Rotations, Vec2<u32>),
|
world_map: &'a (img_ids::Rotations, Vec2<u32>),
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
ori: Vec3<f32>,
|
ori: Vec3<f32>,
|
||||||
@ -53,7 +53,7 @@ impl<'a> MiniMap<'a> {
|
|||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
world_map: &'a (img_ids::Rotations, Vec2<u32>),
|
world_map: &'a (img_ids::Rotations, Vec2<u32>),
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
ori: Vec3<f32>,
|
ori: Vec3<f32>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -46,13 +46,13 @@ use spell::Spell;
|
|||||||
use crate::{
|
use crate::{
|
||||||
ecs::{comp as vcomp, comp::HpFloaterList},
|
ecs::{comp as vcomp, comp::HpFloaterList},
|
||||||
hud::img_ids::ImgsRot,
|
hud::img_ids::ImgsRot,
|
||||||
i18n::{i18n_asset_key, LanguageMetadata, VoxygenLocalization},
|
i18n::{i18n_asset_key, LanguageMetadata, Localization},
|
||||||
render::{Consts, Globals, RenderMode, Renderer},
|
render::{Consts, Globals, RenderMode, Renderer},
|
||||||
scene::{
|
scene::{
|
||||||
camera::{self, Camera},
|
camera::{self, Camera},
|
||||||
lod,
|
lod,
|
||||||
},
|
},
|
||||||
ui::{fonts::ConrodVoxygenFonts, img_ids::Rotations, slot, Graphic, Ingameable, ScaleMode, Ui},
|
ui::{fonts::Fonts, img_ids::Rotations, slot, Graphic, Ingameable, ScaleMode, Ui},
|
||||||
window::{Event as WinEvent, FullScreenSettings, GameInput},
|
window::{Event as WinEvent, FullScreenSettings, GameInput},
|
||||||
GlobalState,
|
GlobalState,
|
||||||
};
|
};
|
||||||
@ -598,7 +598,7 @@ pub struct Hud {
|
|||||||
world_map: (/* Id */ Rotations, Vec2<u32>),
|
world_map: (/* Id */ Rotations, Vec2<u32>),
|
||||||
imgs: Imgs,
|
imgs: Imgs,
|
||||||
item_imgs: ItemImgs,
|
item_imgs: ItemImgs,
|
||||||
fonts: ConrodVoxygenFonts,
|
fonts: Fonts,
|
||||||
rot_imgs: ImgsRot,
|
rot_imgs: ImgsRot,
|
||||||
new_messages: VecDeque<comp::ChatMsg>,
|
new_messages: VecDeque<comp::ChatMsg>,
|
||||||
new_notifications: VecDeque<common::msg::Notification>,
|
new_notifications: VecDeque<common::msg::Notification>,
|
||||||
@ -614,7 +614,7 @@ pub struct Hud {
|
|||||||
tab_complete: Option<String>,
|
tab_complete: Option<String>,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
velocity: f32,
|
velocity: f32,
|
||||||
voxygen_i18n: std::sync::Arc<VoxygenLocalization>,
|
i18n: std::sync::Arc<Localization>,
|
||||||
slot_manager: slots::SlotManager,
|
slot_manager: slots::SlotManager,
|
||||||
hotbar: hotbar::State,
|
hotbar: hotbar::State,
|
||||||
events: Vec<Event>,
|
events: Vec<Event>,
|
||||||
@ -649,12 +649,11 @@ impl Hud {
|
|||||||
// Load item images.
|
// Load item images.
|
||||||
let item_imgs = ItemImgs::new(&mut ui, imgs.not_found);
|
let item_imgs = ItemImgs::new(&mut ui, imgs.not_found);
|
||||||
// Load language.
|
// Load language.
|
||||||
let voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key(
|
let i18n = Localization::load_expect(&i18n_asset_key(
|
||||||
&global_state.settings.language.selected_language,
|
&global_state.settings.language.selected_language,
|
||||||
));
|
));
|
||||||
// Load fonts.
|
// Load fonts.
|
||||||
let fonts = ConrodVoxygenFonts::load(&voxygen_i18n.fonts, &mut ui)
|
let fonts = Fonts::load(&i18n.fonts, &mut ui).expect("Impossible to load fonts!");
|
||||||
.expect("Impossible to load fonts!");
|
|
||||||
// Get the server name.
|
// Get the server name.
|
||||||
let server = &client.server_info.name;
|
let server = &client.server_info.name;
|
||||||
// Get the id, unwrap is safe because this CANNOT be None at this
|
// Get the id, unwrap is safe because this CANNOT be None at this
|
||||||
@ -715,7 +714,7 @@ impl Hud {
|
|||||||
tab_complete: None,
|
tab_complete: None,
|
||||||
pulse: 0.0,
|
pulse: 0.0,
|
||||||
velocity: 0.0,
|
velocity: 0.0,
|
||||||
voxygen_i18n,
|
i18n,
|
||||||
slot_manager,
|
slot_manager,
|
||||||
hotbar: hotbar_state,
|
hotbar: hotbar_state,
|
||||||
events: Vec::new(),
|
events: Vec::new(),
|
||||||
@ -723,10 +722,10 @@ impl Hud {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_language(&mut self, voxygen_i18n: std::sync::Arc<VoxygenLocalization>) {
|
pub fn update_language(&mut self, i18n: std::sync::Arc<Localization>) {
|
||||||
self.voxygen_i18n = voxygen_i18n;
|
self.i18n = i18n;
|
||||||
self.fonts = ConrodVoxygenFonts::load(&self.voxygen_i18n.fonts, &mut self.ui)
|
self.fonts =
|
||||||
.expect("Impossible to load fonts!");
|
Fonts::load(&self.i18n.fonts, &mut self.ui).expect("Impossible to load fonts!");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::assign_op_pattern)] // TODO: Pending review in #587
|
#[allow(clippy::assign_op_pattern)] // TODO: Pending review in #587
|
||||||
@ -1256,7 +1255,7 @@ impl Hud {
|
|||||||
in_group,
|
in_group,
|
||||||
&global_state.settings.gameplay,
|
&global_state.settings.gameplay,
|
||||||
self.pulse,
|
self.pulse,
|
||||||
&self.voxygen_i18n,
|
&self.i18n,
|
||||||
&self.imgs,
|
&self.imgs,
|
||||||
&self.fonts,
|
&self.fonts,
|
||||||
)
|
)
|
||||||
@ -1459,8 +1458,8 @@ impl Hud {
|
|||||||
Intro::Show => {
|
Intro::Show => {
|
||||||
if self.pulse > 20.0 {
|
if self.pulse > 20.0 {
|
||||||
self.show.want_grab = false;
|
self.show.want_grab = false;
|
||||||
let quest_headline = &self.voxygen_i18n.get("hud.temp_quest_headline");
|
let quest_headline = &self.i18n.get("hud.temp_quest_headline");
|
||||||
let quest_text = &self.voxygen_i18n.get("hud.temp_quest_text");
|
let quest_text = &self.i18n.get("hud.temp_quest_text");
|
||||||
Image::new(self.imgs.quest_bg)
|
Image::new(self.imgs.quest_bg)
|
||||||
.w_h(404.0, 858.0)
|
.w_h(404.0, 858.0)
|
||||||
.middle_of(ui_widgets.window)
|
.middle_of(ui_widgets.window)
|
||||||
@ -1497,7 +1496,7 @@ impl Hud {
|
|||||||
.hover_image(self.imgs.button_hover)
|
.hover_image(self.imgs.button_hover)
|
||||||
.press_image(self.imgs.button_press)
|
.press_image(self.imgs.button_press)
|
||||||
.mid_bottom_with_margin_on(self.ids.q_text_bg, -120.0)
|
.mid_bottom_with_margin_on(self.ids.q_text_bg, -120.0)
|
||||||
.label(&self.voxygen_i18n.get("common.accept"))
|
.label(&self.i18n.get("common.accept"))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_font_size(self.fonts.cyri.scale(22))
|
.label_font_size(self.fonts.cyri.scale(22))
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
@ -1675,7 +1674,7 @@ impl Hud {
|
|||||||
if let Some(help_key) = global_state.settings.controls.get_binding(GameInput::Help) {
|
if let Some(help_key) = global_state.settings.controls.get_binding(GameInput::Help) {
|
||||||
Text::new(
|
Text::new(
|
||||||
&self
|
&self
|
||||||
.voxygen_i18n
|
.i18n
|
||||||
.get("hud.press_key_to_toggle_keybindings_fmt")
|
.get("hud.press_key_to_toggle_keybindings_fmt")
|
||||||
.replace("{key}", help_key.to_string().as_str()),
|
.replace("{key}", help_key.to_string().as_str()),
|
||||||
)
|
)
|
||||||
@ -1693,7 +1692,7 @@ impl Hud {
|
|||||||
{
|
{
|
||||||
Text::new(
|
Text::new(
|
||||||
&self
|
&self
|
||||||
.voxygen_i18n
|
.i18n
|
||||||
.get("hud.press_key_to_toggle_debug_info_fmt")
|
.get("hud.press_key_to_toggle_debug_info_fmt")
|
||||||
.replace("{key}", toggle_debug_key.to_string().as_str()),
|
.replace("{key}", toggle_debug_key.to_string().as_str()),
|
||||||
)
|
)
|
||||||
@ -1708,7 +1707,7 @@ impl Hud {
|
|||||||
if let Some(help_key) = global_state.settings.controls.get_binding(GameInput::Help) {
|
if let Some(help_key) = global_state.settings.controls.get_binding(GameInput::Help) {
|
||||||
Text::new(
|
Text::new(
|
||||||
&self
|
&self
|
||||||
.voxygen_i18n
|
.i18n
|
||||||
.get("hud.press_key_to_show_keybindings_fmt")
|
.get("hud.press_key_to_show_keybindings_fmt")
|
||||||
.replace("{key}", help_key.to_string().as_str()),
|
.replace("{key}", help_key.to_string().as_str()),
|
||||||
)
|
)
|
||||||
@ -1726,7 +1725,7 @@ impl Hud {
|
|||||||
{
|
{
|
||||||
Text::new(
|
Text::new(
|
||||||
&self
|
&self
|
||||||
.voxygen_i18n
|
.i18n
|
||||||
.get("hud.press_key_to_show_debug_info_fmt")
|
.get("hud.press_key_to_show_debug_info_fmt")
|
||||||
.replace("{key}", toggle_debug_key.to_string().as_str()),
|
.replace("{key}", toggle_debug_key.to_string().as_str()),
|
||||||
)
|
)
|
||||||
@ -1744,7 +1743,7 @@ impl Hud {
|
|||||||
{
|
{
|
||||||
Text::new(
|
Text::new(
|
||||||
&self
|
&self
|
||||||
.voxygen_i18n
|
.i18n
|
||||||
.get("hud.press_key_to_toggle_lantern_fmt")
|
.get("hud.press_key_to_toggle_lantern_fmt")
|
||||||
.replace("{key}", toggle_lantern_key.to_string().as_str()),
|
.replace("{key}", toggle_lantern_key.to_string().as_str()),
|
||||||
)
|
)
|
||||||
@ -1789,7 +1788,7 @@ impl Hud {
|
|||||||
global_state,
|
global_state,
|
||||||
&self.rot_imgs,
|
&self.rot_imgs,
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n,
|
&self.i18n,
|
||||||
&player_stats,
|
&player_stats,
|
||||||
)
|
)
|
||||||
.set(self.ids.buttons, ui_widgets)
|
.set(self.ids.buttons, ui_widgets)
|
||||||
@ -1811,7 +1810,7 @@ impl Hud {
|
|||||||
&self.fonts,
|
&self.fonts,
|
||||||
&self.rot_imgs,
|
&self.rot_imgs,
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n,
|
&self.i18n,
|
||||||
&player_buffs,
|
&player_buffs,
|
||||||
self.pulse,
|
self.pulse,
|
||||||
&global_state,
|
&global_state,
|
||||||
@ -1831,7 +1830,7 @@ impl Hud {
|
|||||||
&self.imgs,
|
&self.imgs,
|
||||||
&self.rot_imgs,
|
&self.rot_imgs,
|
||||||
&self.fonts,
|
&self.fonts,
|
||||||
&self.voxygen_i18n,
|
&self.i18n,
|
||||||
self.pulse,
|
self.pulse,
|
||||||
&global_state,
|
&global_state,
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
@ -1848,7 +1847,7 @@ impl Hud {
|
|||||||
}
|
}
|
||||||
// Popup (waypoint saved and similar notifications)
|
// Popup (waypoint saved and similar notifications)
|
||||||
Popup::new(
|
Popup::new(
|
||||||
&self.voxygen_i18n,
|
&self.i18n,
|
||||||
client,
|
client,
|
||||||
&self.new_notifications,
|
&self.new_notifications,
|
||||||
&self.fonts,
|
&self.fonts,
|
||||||
@ -1884,7 +1883,7 @@ impl Hud {
|
|||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&mut self.slot_manager,
|
&mut self.slot_manager,
|
||||||
self.pulse,
|
self.pulse,
|
||||||
&self.voxygen_i18n,
|
&self.i18n,
|
||||||
&player_stats,
|
&player_stats,
|
||||||
&self.show,
|
&self.show,
|
||||||
)
|
)
|
||||||
@ -1951,7 +1950,7 @@ impl Hud {
|
|||||||
&self.hotbar,
|
&self.hotbar,
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&mut self.slot_manager,
|
&mut self.slot_manager,
|
||||||
&self.voxygen_i18n,
|
&self.i18n,
|
||||||
&self.show,
|
&self.show,
|
||||||
)
|
)
|
||||||
.set(self.ids.skillbar, ui_widgets);
|
.set(self.ids.skillbar, ui_widgets);
|
||||||
@ -1965,7 +1964,7 @@ impl Hud {
|
|||||||
client,
|
client,
|
||||||
&self.imgs,
|
&self.imgs,
|
||||||
&self.fonts,
|
&self.fonts,
|
||||||
&self.voxygen_i18n,
|
&self.i18n,
|
||||||
&self.rot_imgs,
|
&self.rot_imgs,
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.item_imgs,
|
&self.item_imgs,
|
||||||
@ -2004,7 +2003,7 @@ impl Hud {
|
|||||||
global_state,
|
global_state,
|
||||||
&self.imgs,
|
&self.imgs,
|
||||||
&self.fonts,
|
&self.fonts,
|
||||||
&self.voxygen_i18n,
|
&self.i18n,
|
||||||
)
|
)
|
||||||
.and_then(self.force_chat_input.take(), |c, input| c.input(input))
|
.and_then(self.force_chat_input.take(), |c, input| c.input(input))
|
||||||
.and_then(self.tab_complete.take(), |c, input| {
|
.and_then(self.tab_complete.take(), |c, input| {
|
||||||
@ -2041,7 +2040,7 @@ impl Hud {
|
|||||||
&self.show,
|
&self.show,
|
||||||
&self.imgs,
|
&self.imgs,
|
||||||
&self.fonts,
|
&self.fonts,
|
||||||
&self.voxygen_i18n,
|
&self.i18n,
|
||||||
fps as f32,
|
fps as f32,
|
||||||
)
|
)
|
||||||
.set(self.ids.settings_window, ui_widgets)
|
.set(self.ids.settings_window, ui_widgets)
|
||||||
@ -2194,7 +2193,7 @@ impl Hud {
|
|||||||
client,
|
client,
|
||||||
&self.imgs,
|
&self.imgs,
|
||||||
&self.fonts,
|
&self.fonts,
|
||||||
&self.voxygen_i18n,
|
&self.i18n,
|
||||||
info.selected_entity,
|
info.selected_entity,
|
||||||
&self.rot_imgs,
|
&self.rot_imgs,
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
@ -2222,14 +2221,8 @@ impl Hud {
|
|||||||
|
|
||||||
// Spellbook
|
// Spellbook
|
||||||
if self.show.spell {
|
if self.show.spell {
|
||||||
match Spell::new(
|
match Spell::new(&self.show, client, &self.imgs, &self.fonts, &self.i18n)
|
||||||
&self.show,
|
.set(self.ids.spell, ui_widgets)
|
||||||
client,
|
|
||||||
&self.imgs,
|
|
||||||
&self.fonts,
|
|
||||||
&self.voxygen_i18n,
|
|
||||||
)
|
|
||||||
.set(self.ids.spell, ui_widgets)
|
|
||||||
{
|
{
|
||||||
Some(spell::Event::Close) => {
|
Some(spell::Event::Close) => {
|
||||||
self.show.spell(false);
|
self.show.spell(false);
|
||||||
@ -2249,7 +2242,7 @@ impl Hud {
|
|||||||
&self.world_map,
|
&self.world_map,
|
||||||
&self.fonts,
|
&self.fonts,
|
||||||
self.pulse,
|
self.pulse,
|
||||||
&self.voxygen_i18n,
|
&self.i18n,
|
||||||
&global_state,
|
&global_state,
|
||||||
)
|
)
|
||||||
.set(self.ids.map, ui_widgets)
|
.set(self.ids.map, ui_widgets)
|
||||||
@ -2268,7 +2261,7 @@ impl Hud {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.show.esc_menu {
|
if self.show.esc_menu {
|
||||||
match EscMenu::new(&self.imgs, &self.fonts, &self.voxygen_i18n)
|
match EscMenu::new(&self.imgs, &self.fonts, &self.i18n)
|
||||||
.set(self.ids.esc_menu, ui_widgets)
|
.set(self.ids.esc_menu, ui_widgets)
|
||||||
{
|
{
|
||||||
Some(esc_menu::Event::OpenSettings(tab)) => {
|
Some(esc_menu::Event::OpenSettings(tab)) => {
|
||||||
@ -2311,7 +2304,7 @@ impl Hud {
|
|||||||
if self.show.free_look {
|
if self.show.free_look {
|
||||||
Text::new(
|
Text::new(
|
||||||
&self
|
&self
|
||||||
.voxygen_i18n
|
.i18n
|
||||||
.get("hud.free_look_indicator")
|
.get("hud.free_look_indicator")
|
||||||
.replace("{key}", freelook_key.to_string().as_str()),
|
.replace("{key}", freelook_key.to_string().as_str()),
|
||||||
)
|
)
|
||||||
@ -2322,7 +2315,7 @@ impl Hud {
|
|||||||
.set(self.ids.free_look_bg, ui_widgets);
|
.set(self.ids.free_look_bg, ui_widgets);
|
||||||
Text::new(
|
Text::new(
|
||||||
&self
|
&self
|
||||||
.voxygen_i18n
|
.i18n
|
||||||
.get("hud.free_look_indicator")
|
.get("hud.free_look_indicator")
|
||||||
.replace("{key}", freelook_key.to_string().as_str()),
|
.replace("{key}", freelook_key.to_string().as_str()),
|
||||||
)
|
)
|
||||||
@ -2336,13 +2329,13 @@ impl Hud {
|
|||||||
|
|
||||||
// Auto walk indicator
|
// Auto walk indicator
|
||||||
if self.show.auto_walk {
|
if self.show.auto_walk {
|
||||||
Text::new(&self.voxygen_i18n.get("hud.auto_walk_indicator"))
|
Text::new(&self.i18n.get("hud.auto_walk_indicator"))
|
||||||
.color(TEXT_BG)
|
.color(TEXT_BG)
|
||||||
.mid_top_with_margin_on(ui_widgets.window, 70.0)
|
.mid_top_with_margin_on(ui_widgets.window, 70.0)
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
.font_size(self.fonts.cyri.scale(20))
|
.font_size(self.fonts.cyri.scale(20))
|
||||||
.set(self.ids.auto_walk_bg, ui_widgets);
|
.set(self.ids.auto_walk_bg, ui_widgets);
|
||||||
Text::new(&self.voxygen_i18n.get("hud.auto_walk_indicator"))
|
Text::new(&self.i18n.get("hud.auto_walk_indicator"))
|
||||||
.color(KILL_COLOR)
|
.color(KILL_COLOR)
|
||||||
.top_left_with_margins_on(self.ids.auto_walk_bg, -1.0, -1.0)
|
.top_left_with_margins_on(self.ids.auto_walk_bg, -1.0, -1.0)
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
|
@ -4,9 +4,9 @@ use super::{
|
|||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
hud::get_buff_info,
|
hud::get_buff_info,
|
||||||
i18n::VoxygenLocalization,
|
i18n::Localization,
|
||||||
settings::GameplaySettings,
|
settings::GameplaySettings,
|
||||||
ui::{fonts::ConrodVoxygenFonts, Ingameable},
|
ui::{fonts::Fonts, Ingameable},
|
||||||
};
|
};
|
||||||
use common::comp::{BuffKind, Buffs, Energy, Health, SpeechBubble, SpeechBubbleType, Stats};
|
use common::comp::{BuffKind, Buffs, Energy, Health, SpeechBubble, SpeechBubbleType, Stats};
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
@ -76,9 +76,9 @@ pub struct Overhead<'a> {
|
|||||||
in_group: bool,
|
in_group: bool,
|
||||||
settings: &'a GameplaySettings,
|
settings: &'a GameplaySettings,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
voxygen_i18n: &'a std::sync::Arc<VoxygenLocalization>,
|
i18n: &'a Localization,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
|
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
@ -93,9 +93,9 @@ impl<'a> Overhead<'a> {
|
|||||||
in_group: bool,
|
in_group: bool,
|
||||||
settings: &'a GameplaySettings,
|
settings: &'a GameplaySettings,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
voxygen_i18n: &'a std::sync::Arc<VoxygenLocalization>,
|
i18n: &'a Localization,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
info,
|
info,
|
||||||
@ -104,7 +104,7 @@ impl<'a> Overhead<'a> {
|
|||||||
in_group,
|
in_group,
|
||||||
settings,
|
settings,
|
||||||
pulse,
|
pulse,
|
||||||
voxygen_i18n,
|
i18n,
|
||||||
imgs,
|
imgs,
|
||||||
fonts,
|
fonts,
|
||||||
common: widget::CommonBuilder::default(),
|
common: widget::CommonBuilder::default(),
|
||||||
@ -336,7 +336,7 @@ impl<'a> Widget for Overhead<'a> {
|
|||||||
.set(state.ids.health_bar, ui);
|
.set(state.ids.health_bar, ui);
|
||||||
let mut txt = format!("{}/{}", health_cur_txt, health_max_txt);
|
let mut txt = format!("{}/{}", health_cur_txt, health_max_txt);
|
||||||
if health.is_dead {
|
if health.is_dead {
|
||||||
txt = self.voxygen_i18n.get("hud.group.dead").to_string()
|
txt = self.i18n.get("hud.group.dead").to_string()
|
||||||
};
|
};
|
||||||
Text::new(&txt)
|
Text::new(&txt)
|
||||||
.mid_top_with_margin_on(state.ids.health_bar_bg, 2.0)
|
.mid_top_with_margin_on(state.ids.health_bar_bg, 2.0)
|
||||||
@ -420,8 +420,7 @@ impl<'a> Widget for Overhead<'a> {
|
|||||||
// Speech bubble
|
// Speech bubble
|
||||||
if let Some(bubble) = self.bubble {
|
if let Some(bubble) = self.bubble {
|
||||||
let dark_mode = self.settings.speech_bubble_dark_mode;
|
let dark_mode = self.settings.speech_bubble_dark_mode;
|
||||||
let localizer =
|
let localizer = |s: &str, i| -> String { self.i18n.get_variation(&s, i).to_string() };
|
||||||
|s: &str, i| -> String { self.voxygen_i18n.get_variation(&s, i).to_string() };
|
|
||||||
let bubble_contents: String = bubble.message(localizer);
|
let bubble_contents: String = bubble.message(localizer);
|
||||||
let (text_color, shadow_color) = bubble_color(&bubble, dark_mode);
|
let (text_color, shadow_color) = bubble_color(&bubble, dark_mode);
|
||||||
let mut text = Text::new(&bubble_contents)
|
let mut text = Text::new(&bubble_contents)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
settings::ControlSettings,
|
settings::ControlSettings,
|
||||||
ui::{fonts::ConrodVoxygenFonts, Ingameable},
|
ui::{fonts::Fonts, Ingameable},
|
||||||
window::GameInput,
|
window::GameInput,
|
||||||
};
|
};
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
@ -25,7 +25,7 @@ widget_ids! {
|
|||||||
pub struct Overitem<'a> {
|
pub struct Overitem<'a> {
|
||||||
name: &'a str,
|
name: &'a str,
|
||||||
distance_from_player_sqr: &'a f32,
|
distance_from_player_sqr: &'a f32,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
controls: &'a ControlSettings,
|
controls: &'a ControlSettings,
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
@ -35,7 +35,7 @@ impl<'a> Overitem<'a> {
|
|||||||
pub fn new(
|
pub fn new(
|
||||||
name: &'a str,
|
name: &'a str,
|
||||||
distance_from_player_sqr: &'a f32,
|
distance_from_player_sqr: &'a f32,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
controls: &'a ControlSettings,
|
controls: &'a ControlSettings,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::Show;
|
use super::Show;
|
||||||
use crate::{i18n::VoxygenLocalization, ui::fonts::ConrodVoxygenFonts};
|
use crate::{i18n::Localization, ui::fonts::Fonts};
|
||||||
use client::{self, Client};
|
use client::{self, Client};
|
||||||
use common::msg::Notification;
|
use common::msg::Notification;
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
@ -21,10 +21,10 @@ widget_ids! {
|
|||||||
|
|
||||||
#[derive(WidgetCommon)]
|
#[derive(WidgetCommon)]
|
||||||
pub struct Popup<'a> {
|
pub struct Popup<'a> {
|
||||||
voxygen_i18n: &'a std::sync::Arc<VoxygenLocalization>,
|
i18n: &'a Localization,
|
||||||
client: &'a Client,
|
client: &'a Client,
|
||||||
new_notifications: &'a VecDeque<Notification>,
|
new_notifications: &'a VecDeque<Notification>,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
show: &'a Show,
|
show: &'a Show,
|
||||||
@ -34,14 +34,14 @@ pub struct Popup<'a> {
|
|||||||
/// Dungeon Cleared (TODO), and Quest Completed (TODO)
|
/// Dungeon Cleared (TODO), and Quest Completed (TODO)
|
||||||
impl<'a> Popup<'a> {
|
impl<'a> Popup<'a> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
voxygen_i18n: &'a std::sync::Arc<VoxygenLocalization>,
|
i18n: &'a Localization,
|
||||||
client: &'a Client,
|
client: &'a Client,
|
||||||
new_notifications: &'a VecDeque<Notification>,
|
new_notifications: &'a VecDeque<Notification>,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
show: &'a Show,
|
show: &'a Show,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
voxygen_i18n,
|
i18n,
|
||||||
client,
|
client,
|
||||||
new_notifications,
|
new_notifications,
|
||||||
fonts,
|
fonts,
|
||||||
@ -126,7 +126,7 @@ impl<'a> Widget for Popup<'a> {
|
|||||||
if s.infos.is_empty() {
|
if s.infos.is_empty() {
|
||||||
s.last_info_update = Instant::now();
|
s.last_info_update = Instant::now();
|
||||||
}
|
}
|
||||||
let text = self.voxygen_i18n.get("hud.waypoint_saved");
|
let text = self.i18n.get("hud.waypoint_saved");
|
||||||
s.infos.push_back(text.to_string());
|
s.infos.push_back(text.to_string());
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -5,9 +5,9 @@ use super::{
|
|||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
hud::BuffPosition,
|
hud::BuffPosition,
|
||||||
i18n::{list_localizations, LanguageMetadata, VoxygenLocalization},
|
i18n::{list_localizations, LanguageMetadata, Localization},
|
||||||
render::{AaMode, CloudMode, FluidMode, LightingMode, RenderMode, ShadowMapMode, ShadowMode},
|
render::{AaMode, CloudMode, FluidMode, LightingMode, RenderMode, ShadowMapMode, ShadowMode},
|
||||||
ui::{fonts::ConrodVoxygenFonts, ImageSlider, ScaleMode, ToggleButton},
|
ui::{fonts::Fonts, ImageSlider, ScaleMode, ToggleButton},
|
||||||
window::{FullScreenSettings, FullscreenMode, GameInput},
|
window::{FullScreenSettings, FullscreenMode, GameInput},
|
||||||
GlobalState,
|
GlobalState,
|
||||||
};
|
};
|
||||||
@ -227,8 +227,8 @@ pub struct SettingsWindow<'a> {
|
|||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
show: &'a Show,
|
show: &'a Show,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
fps: f32,
|
fps: f32,
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
@ -239,8 +239,8 @@ impl<'a> SettingsWindow<'a> {
|
|||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
show: &'a Show,
|
show: &'a Show,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
fps: f32,
|
fps: f32,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -6,9 +6,9 @@ use super::{
|
|||||||
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::Localization,
|
||||||
ui::{
|
ui::{
|
||||||
fonts::ConrodVoxygenFonts,
|
fonts::Fonts,
|
||||||
slot::{ContentSize, SlotMaker},
|
slot::{ContentSize, SlotMaker},
|
||||||
ImageFrame, Tooltip, TooltipManager, Tooltipable,
|
ImageFrame, Tooltip, TooltipManager, Tooltipable,
|
||||||
},
|
},
|
||||||
@ -121,7 +121,7 @@ pub struct Skillbar<'a> {
|
|||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
item_imgs: &'a ItemImgs,
|
item_imgs: &'a ItemImgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
stats: &'a Stats,
|
stats: &'a Stats,
|
||||||
health: &'a Health,
|
health: &'a Health,
|
||||||
@ -133,7 +133,7 @@ pub struct Skillbar<'a> {
|
|||||||
hotbar: &'a hotbar::State,
|
hotbar: &'a hotbar::State,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
slot_manager: &'a mut slots::SlotManager,
|
slot_manager: &'a mut slots::SlotManager,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
pulse: f32,
|
pulse: f32,
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
@ -146,7 +146,7 @@ impl<'a> Skillbar<'a> {
|
|||||||
global_state: &'a GlobalState,
|
global_state: &'a GlobalState,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
item_imgs: &'a ItemImgs,
|
item_imgs: &'a ItemImgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
stats: &'a Stats,
|
stats: &'a Stats,
|
||||||
health: &'a Health,
|
health: &'a Health,
|
||||||
@ -159,7 +159,7 @@ impl<'a> Skillbar<'a> {
|
|||||||
hotbar: &'a hotbar::State,
|
hotbar: &'a hotbar::State,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
slot_manager: &'a mut slots::SlotManager,
|
slot_manager: &'a mut slots::SlotManager,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
show: &'a Show,
|
show: &'a Show,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -4,8 +4,8 @@ use super::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
i18n::VoxygenLocalization,
|
i18n::Localization,
|
||||||
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||||
};
|
};
|
||||||
use client::{self, Client};
|
use client::{self, Client};
|
||||||
use common::{comp::group, sync::Uid};
|
use common::{comp::group, sync::Uid};
|
||||||
@ -66,8 +66,8 @@ pub struct Social<'a> {
|
|||||||
show: &'a Show,
|
show: &'a Show,
|
||||||
client: &'a Client,
|
client: &'a Client,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
selected_entity: Option<(specs::Entity, Instant)>,
|
selected_entity: Option<(specs::Entity, Instant)>,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
@ -82,8 +82,8 @@ impl<'a> Social<'a> {
|
|||||||
show: &'a Show,
|
show: &'a Show,
|
||||||
client: &'a Client,
|
client: &'a Client,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
selected_entity: Option<(specs::Entity, Instant)>,
|
selected_entity: Option<(specs::Entity, Instant)>,
|
||||||
rot_imgs: &'a ImgsRot,
|
rot_imgs: &'a ImgsRot,
|
||||||
tooltip_manager: &'a mut TooltipManager,
|
tooltip_manager: &'a mut TooltipManager,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::{img_ids::Imgs, Show, TEXT_COLOR, UI_MAIN};
|
use super::{img_ids::Imgs, Show, TEXT_COLOR, UI_MAIN};
|
||||||
use crate::{i18n::VoxygenLocalization, ui::fonts::ConrodVoxygenFonts};
|
use crate::{i18n::Localization, ui::fonts::Fonts};
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
color,
|
color,
|
||||||
widget::{self, Button, Image, Rectangle, Text},
|
widget::{self, Button, Image, Rectangle, Text},
|
||||||
@ -24,8 +24,8 @@ pub struct Spell<'a> {
|
|||||||
_client: &'a Client,
|
_client: &'a Client,
|
||||||
|
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
|
|
||||||
#[conrod(common_builder)]
|
#[conrod(common_builder)]
|
||||||
common: widget::CommonBuilder,
|
common: widget::CommonBuilder,
|
||||||
@ -36,8 +36,8 @@ impl<'a> Spell<'a> {
|
|||||||
show: &'a Show,
|
show: &'a Show,
|
||||||
_client: &'a Client,
|
_client: &'a Client,
|
||||||
imgs: &'a Imgs,
|
imgs: &'a Imgs,
|
||||||
fonts: &'a ConrodVoxygenFonts,
|
fonts: &'a Fonts,
|
||||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
localized_strings: &'a Localization,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
_show: show,
|
_show: show,
|
||||||
|
@ -44,11 +44,11 @@ impl Font {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Store font metadata
|
/// Store font metadata
|
||||||
pub type VoxygenFonts = HashMap<String, Font>;
|
pub type Fonts = HashMap<String, Font>;
|
||||||
|
|
||||||
/// Store internationalization data
|
/// Store internationalization data
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct VoxygenLocalization {
|
pub struct Localization {
|
||||||
/// A map storing the localized texts
|
/// A map storing the localized texts
|
||||||
///
|
///
|
||||||
/// Localized content can be accessed using a String key.
|
/// Localized content can be accessed using a String key.
|
||||||
@ -64,12 +64,12 @@ pub struct VoxygenLocalization {
|
|||||||
pub convert_utf8_to_ascii: bool,
|
pub convert_utf8_to_ascii: bool,
|
||||||
|
|
||||||
/// Font configuration is stored here
|
/// Font configuration is stored here
|
||||||
pub fonts: VoxygenFonts,
|
pub fonts: Fonts,
|
||||||
|
|
||||||
pub metadata: LanguageMetadata,
|
pub metadata: LanguageMetadata,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VoxygenLocalization {
|
impl Localization {
|
||||||
/// Get a localized text from the given key
|
/// Get a localized text from the given key
|
||||||
///
|
///
|
||||||
/// If the key is not present in the localization object
|
/// If the key is not present in the localization object
|
||||||
@ -97,7 +97,7 @@ impl VoxygenLocalization {
|
|||||||
/// Return the missing keys compared to the reference language
|
/// Return the missing keys compared to the reference language
|
||||||
pub fn list_missing_entries(&self) -> (HashSet<String>, HashSet<String>) {
|
pub fn list_missing_entries(&self) -> (HashSet<String>, HashSet<String>) {
|
||||||
let reference_localization =
|
let reference_localization =
|
||||||
VoxygenLocalization::load_expect(i18n_asset_key(REFERENCE_LANG).as_ref());
|
Localization::load_expect(i18n_asset_key(REFERENCE_LANG).as_ref());
|
||||||
|
|
||||||
let reference_string_keys: HashSet<_> =
|
let reference_string_keys: HashSet<_> =
|
||||||
reference_localization.string_map.keys().cloned().collect();
|
reference_localization.string_map.keys().cloned().collect();
|
||||||
@ -136,14 +136,14 @@ impl VoxygenLocalization {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Asset for VoxygenLocalization {
|
impl Asset for Localization {
|
||||||
const ENDINGS: &'static [&'static str] = &["ron"];
|
const ENDINGS: &'static [&'static str] = &["ron"];
|
||||||
|
|
||||||
/// Load the translations located in the input buffer and convert them
|
/// Load the translations located in the input buffer and convert them
|
||||||
/// into a `VoxygenLocalization` object.
|
/// into a `Localization` object.
|
||||||
#[allow(clippy::into_iter_on_ref)] // TODO: Pending review in #587
|
#[allow(clippy::into_iter_on_ref)] // TODO: Pending review in #587
|
||||||
fn parse(buf_reader: BufReader<File>, _specifier: &str) -> Result<Self, assets::Error> {
|
fn parse(buf_reader: BufReader<File>, _specifier: &str) -> Result<Self, assets::Error> {
|
||||||
let mut asked_localization: VoxygenLocalization =
|
let mut asked_localization: Localization =
|
||||||
from_reader(buf_reader).map_err(assets::Error::parse_error)?;
|
from_reader(buf_reader).map_err(assets::Error::parse_error)?;
|
||||||
|
|
||||||
// Update the text if UTF-8 to ASCII conversion is enabled
|
// Update the text if UTF-8 to ASCII conversion is enabled
|
||||||
@ -163,10 +163,10 @@ impl Asset for VoxygenLocalization {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Load all the available languages located in the Voxygen asset directory
|
/// Load all the available languages located in the voxygen asset directory
|
||||||
pub fn list_localizations() -> Vec<LanguageMetadata> {
|
pub fn list_localizations() -> Vec<LanguageMetadata> {
|
||||||
let voxygen_locales_assets = "voxygen.i18n.*";
|
let voxygen_locales_assets = "voxygen.i18n.*";
|
||||||
let lang_list = VoxygenLocalization::load_glob(voxygen_locales_assets).unwrap();
|
let lang_list = Localization::load_glob(voxygen_locales_assets).unwrap();
|
||||||
lang_list.iter().map(|e| (*e).metadata.clone()).collect()
|
lang_list.iter().map(|e| (*e).metadata.clone()).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ pub fn i18n_asset_key(language_id: &str) -> String { "voxygen.i18n.".to_string()
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::VoxygenLocalization;
|
use super::Localization;
|
||||||
use git2::Repository;
|
use git2::Repository;
|
||||||
use ron::de::{from_bytes, from_reader};
|
use ron::de::{from_bytes, from_reader};
|
||||||
use std::{
|
use std::{
|
||||||
@ -248,7 +248,7 @@ mod tests {
|
|||||||
|
|
||||||
fn generate_key_version<'a>(
|
fn generate_key_version<'a>(
|
||||||
repo: &'a git2::Repository,
|
repo: &'a git2::Repository,
|
||||||
localization: &VoxygenLocalization,
|
localization: &Localization,
|
||||||
path: &std::path::Path,
|
path: &std::path::Path,
|
||||||
file_blob: &git2::Blob,
|
file_blob: &git2::Blob,
|
||||||
) -> HashMap<String, LocalizationEntryState> {
|
) -> HashMap<String, LocalizationEntryState> {
|
||||||
@ -348,7 +348,7 @@ mod tests {
|
|||||||
);
|
);
|
||||||
for path in i18n_files {
|
for path in i18n_files {
|
||||||
let f = fs::File::open(&path).expect("Failed opening file");
|
let f = fs::File::open(&path).expect("Failed opening file");
|
||||||
let _: VoxygenLocalization = match from_reader(f) {
|
let _: Localization = match from_reader(f) {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
panic!(
|
panic!(
|
||||||
@ -387,7 +387,7 @@ mod tests {
|
|||||||
|
|
||||||
// Read HEAD for the reference language file
|
// Read HEAD for the reference language file
|
||||||
let i18n_en_blob = read_file_from_path(&repo, &head_ref, &en_i18n_path);
|
let i18n_en_blob = read_file_from_path(&repo, &head_ref, &en_i18n_path);
|
||||||
let loc: VoxygenLocalization = from_bytes(i18n_en_blob.content())
|
let loc: Localization = from_bytes(i18n_en_blob.content())
|
||||||
.expect("Expect to parse reference i18n RON file, can't proceed without it");
|
.expect("Expect to parse reference i18n RON file, can't proceed without it");
|
||||||
let i18n_references: HashMap<String, LocalizationEntryState> =
|
let i18n_references: HashMap<String, LocalizationEntryState> =
|
||||||
generate_key_version(&repo, &loc, &en_i18n_path, &i18n_en_blob);
|
generate_key_version(&repo, &loc, &en_i18n_path, &i18n_en_blob);
|
||||||
@ -406,7 +406,7 @@ mod tests {
|
|||||||
|
|
||||||
// Find the localization entry state
|
// Find the localization entry state
|
||||||
let current_blob = read_file_from_path(&repo, &head_ref, &relfile);
|
let current_blob = read_file_from_path(&repo, &head_ref, &relfile);
|
||||||
let current_loc: VoxygenLocalization = match from_bytes(current_blob.content()) {
|
let current_loc: Localization = match from_bytes(current_blob.content()) {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
use veloren_voxygen::{
|
use veloren_voxygen::{
|
||||||
audio::{self, AudioFrontend},
|
audio::{self, AudioFrontend},
|
||||||
i18n::{self, i18n_asset_key, VoxygenLocalization},
|
i18n::{self, i18n_asset_key, Localization},
|
||||||
logging,
|
logging,
|
||||||
profile::Profile,
|
profile::Profile,
|
||||||
run,
|
run,
|
||||||
@ -157,7 +157,7 @@ fn main() {
|
|||||||
let profile = Profile::load();
|
let profile = Profile::load();
|
||||||
|
|
||||||
let mut localization_watcher = watch::ReloadIndicator::new();
|
let mut localization_watcher = watch::ReloadIndicator::new();
|
||||||
let localized_strings = VoxygenLocalization::load_watched(
|
let localized_strings = Localization::load_watched(
|
||||||
&i18n_asset_key(&settings.language.selected_language),
|
&i18n_asset_key(&settings.language.selected_language),
|
||||||
&mut localization_watcher,
|
&mut localization_watcher,
|
||||||
)
|
)
|
||||||
@ -169,7 +169,7 @@ fn main() {
|
|||||||
"Impossible to load language: change to the default language (English) instead.",
|
"Impossible to load language: change to the default language (English) instead.",
|
||||||
);
|
);
|
||||||
settings.language.selected_language = i18n::REFERENCE_LANG.to_owned();
|
settings.language.selected_language = i18n::REFERENCE_LANG.to_owned();
|
||||||
VoxygenLocalization::load_watched(
|
Localization::load_watched(
|
||||||
&i18n_asset_key(&settings.language.selected_language),
|
&i18n_asset_key(&settings.language.selected_language),
|
||||||
&mut localization_watcher,
|
&mut localization_watcher,
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
mod ui;
|
mod ui;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
i18n::{i18n_asset_key, VoxygenLocalization},
|
i18n::{i18n_asset_key, Localization},
|
||||||
render::Renderer,
|
render::Renderer,
|
||||||
scene::simple::{self as scene, Scene},
|
scene::simple::{self as scene, Scene},
|
||||||
session::SessionState,
|
session::SessionState,
|
||||||
@ -149,7 +149,7 @@ impl PlayState for CharSelectionState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tick the client (currently only to keep the connection alive).
|
// Tick the client (currently only to keep the connection alive).
|
||||||
let localized_strings = VoxygenLocalization::load_expect(&i18n_asset_key(
|
let localized_strings = Localization::load_expect(&i18n_asset_key(
|
||||||
&global_state.settings.language.selected_language,
|
&global_state.settings.language.selected_language,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
i18n::{i18n_asset_key, VoxygenLocalization},
|
i18n::{i18n_asset_key, Localization},
|
||||||
render::{Consts, Globals, Renderer},
|
render::{Consts, Globals, Renderer},
|
||||||
ui::{
|
ui::{
|
||||||
fonts::ConrodVoxygenFonts,
|
fonts::Fonts,
|
||||||
img_ids::{BlankGraphic, ImageGraphic, VoxelGraphic, VoxelSs9Graphic},
|
img_ids::{BlankGraphic, ImageGraphic, VoxelGraphic, VoxelSs9Graphic},
|
||||||
ImageFrame, ImageSlider, Tooltip, Tooltipable, Ui,
|
ImageFrame, ImageSlider, Tooltip, Tooltipable, Ui,
|
||||||
},
|
},
|
||||||
@ -26,7 +26,6 @@ use conrod_core::{
|
|||||||
widget_ids, Borderable, Color, Colorable, Labelable, Positionable, Sizeable, UiCell, Widget,
|
widget_ids, Borderable, Color, Colorable, Labelable, Positionable, Sizeable, UiCell, Widget,
|
||||||
};
|
};
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
const STARTER_HAMMER: &str = "common.items.weapons.hammer.starter_hammer";
|
const STARTER_HAMMER: &str = "common.items.weapons.hammer.starter_hammer";
|
||||||
const STARTER_BOW: &str = "common.items.weapons.bow.starter_bow";
|
const STARTER_BOW: &str = "common.items.weapons.bow.starter_bow";
|
||||||
@ -300,9 +299,9 @@ pub struct CharSelectionUi {
|
|||||||
ids: Ids,
|
ids: Ids,
|
||||||
imgs: Imgs,
|
imgs: Imgs,
|
||||||
rot_imgs: ImgsRot,
|
rot_imgs: ImgsRot,
|
||||||
fonts: ConrodVoxygenFonts,
|
fonts: Fonts,
|
||||||
info_content: InfoContent,
|
info_content: InfoContent,
|
||||||
voxygen_i18n: Arc<VoxygenLocalization>,
|
i18n: std::sync::Arc<Localization>,
|
||||||
enter: bool,
|
enter: bool,
|
||||||
pub mode: Mode,
|
pub mode: Mode,
|
||||||
pub selected_character: usize,
|
pub selected_character: usize,
|
||||||
@ -321,12 +320,11 @@ impl CharSelectionUi {
|
|||||||
let imgs = Imgs::load(&mut ui).expect("Failed to load images!");
|
let imgs = Imgs::load(&mut ui).expect("Failed to load images!");
|
||||||
let rot_imgs = ImgsRot::load(&mut ui).expect("Failed to load images!");
|
let rot_imgs = ImgsRot::load(&mut ui).expect("Failed to load images!");
|
||||||
// Load language
|
// Load language
|
||||||
let voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key(
|
let i18n = Localization::load_expect(&i18n_asset_key(
|
||||||
&global_state.settings.language.selected_language,
|
&global_state.settings.language.selected_language,
|
||||||
));
|
));
|
||||||
// Load fonts.
|
// Load fonts.
|
||||||
let fonts = ConrodVoxygenFonts::load(&voxygen_i18n.fonts, &mut ui)
|
let fonts = Fonts::load(&i18n.fonts, &mut ui).expect("Impossible to load fonts!");
|
||||||
.expect("Impossible to load fonts!");
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
ui,
|
ui,
|
||||||
@ -336,7 +334,7 @@ impl CharSelectionUi {
|
|||||||
fonts,
|
fonts,
|
||||||
info_content: InfoContent::LoadingCharacters,
|
info_content: InfoContent::LoadingCharacters,
|
||||||
selected_character: 0,
|
selected_character: 0,
|
||||||
voxygen_i18n,
|
i18n,
|
||||||
mode: Mode::Select(None),
|
mode: Mode::Select(None),
|
||||||
enter: false,
|
enter: false,
|
||||||
}
|
}
|
||||||
@ -483,7 +481,7 @@ impl CharSelectionUi {
|
|||||||
match self.info_content {
|
match self.info_content {
|
||||||
InfoContent::None => unreachable!(),
|
InfoContent::None => unreachable!(),
|
||||||
InfoContent::Deletion(character_index) => {
|
InfoContent::Deletion(character_index) => {
|
||||||
Text::new(&self.voxygen_i18n.get("char_selection.delete_permanently"))
|
Text::new(&self.i18n.get("char_selection.delete_permanently"))
|
||||||
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
||||||
.font_size(self.fonts.cyri.scale(24))
|
.font_size(self.fonts.cyri.scale(24))
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
@ -495,7 +493,7 @@ impl CharSelectionUi {
|
|||||||
.hover_image(self.imgs.button_hover)
|
.hover_image(self.imgs.button_hover)
|
||||||
.press_image(self.imgs.button_press)
|
.press_image(self.imgs.button_press)
|
||||||
.label_y(Relative::Scalar(2.0))
|
.label_y(Relative::Scalar(2.0))
|
||||||
.label(&self.voxygen_i18n.get("common.no"))
|
.label(&self.i18n.get("common.no"))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_font_size(self.fonts.cyri.scale(18))
|
.label_font_size(self.fonts.cyri.scale(18))
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
@ -510,7 +508,7 @@ impl CharSelectionUi {
|
|||||||
.hover_image(self.imgs.button_hover)
|
.hover_image(self.imgs.button_hover)
|
||||||
.press_image(self.imgs.button_press)
|
.press_image(self.imgs.button_press)
|
||||||
.label_y(Relative::Scalar(2.0))
|
.label_y(Relative::Scalar(2.0))
|
||||||
.label(&self.voxygen_i18n.get("common.yes"))
|
.label(&self.i18n.get("common.yes"))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_font_size(self.fonts.cyri.scale(18))
|
.label_font_size(self.fonts.cyri.scale(18))
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
@ -532,7 +530,7 @@ impl CharSelectionUi {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
InfoContent::LoadingCharacters => {
|
InfoContent::LoadingCharacters => {
|
||||||
Text::new(&self.voxygen_i18n.get("char_selection.loading_characters"))
|
Text::new(&self.i18n.get("char_selection.loading_characters"))
|
||||||
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
||||||
.font_size(self.fonts.cyri.scale(24))
|
.font_size(self.fonts.cyri.scale(24))
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
@ -540,7 +538,7 @@ impl CharSelectionUi {
|
|||||||
.set(self.ids.loading_characters_text, ui_widgets);
|
.set(self.ids.loading_characters_text, ui_widgets);
|
||||||
},
|
},
|
||||||
InfoContent::CreatingCharacter => {
|
InfoContent::CreatingCharacter => {
|
||||||
Text::new(&self.voxygen_i18n.get("char_selection.creating_character"))
|
Text::new(&self.i18n.get("char_selection.creating_character"))
|
||||||
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
||||||
.font_size(self.fonts.cyri.scale(24))
|
.font_size(self.fonts.cyri.scale(24))
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
@ -548,7 +546,7 @@ impl CharSelectionUi {
|
|||||||
.set(self.ids.creating_character_text, ui_widgets);
|
.set(self.ids.creating_character_text, ui_widgets);
|
||||||
},
|
},
|
||||||
InfoContent::DeletingCharacter => {
|
InfoContent::DeletingCharacter => {
|
||||||
Text::new(&self.voxygen_i18n.get("char_selection.deleting_character"))
|
Text::new(&self.i18n.get("char_selection.deleting_character"))
|
||||||
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
||||||
.font_size(self.fonts.cyri.scale(24))
|
.font_size(self.fonts.cyri.scale(24))
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
@ -559,7 +557,7 @@ impl CharSelectionUi {
|
|||||||
if let Some(error_message) = &client.character_list.error {
|
if let Some(error_message) = &client.character_list.error {
|
||||||
Text::new(&format!(
|
Text::new(&format!(
|
||||||
"{}: {}",
|
"{}: {}",
|
||||||
&self.voxygen_i18n.get("common.error"),
|
&self.i18n.get("common.error"),
|
||||||
error_message
|
error_message
|
||||||
))
|
))
|
||||||
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
.mid_top_with_margin_on(self.ids.info_frame, 40.0)
|
||||||
@ -574,7 +572,7 @@ impl CharSelectionUi {
|
|||||||
.hover_image(self.imgs.button_hover)
|
.hover_image(self.imgs.button_hover)
|
||||||
.press_image(self.imgs.button_press)
|
.press_image(self.imgs.button_press)
|
||||||
.label_y(Relative::Scalar(2.0))
|
.label_y(Relative::Scalar(2.0))
|
||||||
.label(&self.voxygen_i18n.get("common.close"))
|
.label(&self.i18n.get("common.close"))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_font_size(self.fonts.cyri.scale(18))
|
.label_font_size(self.fonts.cyri.scale(18))
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
@ -644,7 +642,7 @@ impl CharSelectionUi {
|
|||||||
.parent(self.ids.charlist_bg)
|
.parent(self.ids.charlist_bg)
|
||||||
.hover_image(self.imgs.button_hover)
|
.hover_image(self.imgs.button_hover)
|
||||||
.press_image(self.imgs.button_press)
|
.press_image(self.imgs.button_press)
|
||||||
.label(&self.voxygen_i18n.get("char_selection.change_server"))
|
.label(&self.i18n.get("char_selection.change_server"))
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_font_size(self.fonts.cyri.scale(18))
|
.label_font_size(self.fonts.cyri.scale(18))
|
||||||
@ -657,7 +655,7 @@ impl CharSelectionUi {
|
|||||||
|
|
||||||
// Enter World Button
|
// Enter World Button
|
||||||
let character_count = client.character_list.characters.len();
|
let character_count = client.character_list.characters.len();
|
||||||
let enter_world_str = &self.voxygen_i18n.get("char_selection.enter_world");
|
let enter_world_str = &self.i18n.get("char_selection.enter_world");
|
||||||
let enter_button = Button::image(self.imgs.button)
|
let enter_button = Button::image(self.imgs.button)
|
||||||
.mid_bottom_with_margin_on(ui_widgets.window, 10.0)
|
.mid_bottom_with_margin_on(ui_widgets.window, 10.0)
|
||||||
.w_h(250.0, 60.0)
|
.w_h(250.0, 60.0)
|
||||||
@ -691,7 +689,7 @@ impl CharSelectionUi {
|
|||||||
.w_h(150.0, 40.0)
|
.w_h(150.0, 40.0)
|
||||||
.hover_image(self.imgs.button_hover)
|
.hover_image(self.imgs.button_hover)
|
||||||
.press_image(self.imgs.button_press)
|
.press_image(self.imgs.button_press)
|
||||||
.label(&self.voxygen_i18n.get("char_selection.logout"))
|
.label(&self.i18n.get("char_selection.logout"))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
.label_font_size(self.fonts.cyri.scale(20))
|
.label_font_size(self.fonts.cyri.scale(20))
|
||||||
@ -772,7 +770,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.delete_button_press)
|
.press_image(self.imgs.delete_button_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("char_selection.delete_permanently"),
|
&self.i18n.get("char_selection.delete_permanently"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -791,7 +789,7 @@ impl CharSelectionUi {
|
|||||||
|
|
||||||
Text::new(
|
Text::new(
|
||||||
&self
|
&self
|
||||||
.voxygen_i18n
|
.i18n
|
||||||
.get("char_selection.level_fmt")
|
.get("char_selection.level_fmt")
|
||||||
.replace("{level_nb}", &character_item.level.to_string()),
|
.replace("{level_nb}", &character_item.level.to_string()),
|
||||||
)
|
)
|
||||||
@ -801,7 +799,7 @@ impl CharSelectionUi {
|
|||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
.set(self.ids.character_levels[i], ui_widgets);
|
.set(self.ids.character_levels[i], ui_widgets);
|
||||||
|
|
||||||
Text::new(&self.voxygen_i18n.get("char_selection.uncanny_valley"))
|
Text::new(&self.i18n.get("char_selection.uncanny_valley"))
|
||||||
.down_from(self.ids.character_levels[i], 4.0)
|
.down_from(self.ids.character_levels[i], 4.0)
|
||||||
.font_size(self.fonts.cyri.scale(17))
|
.font_size(self.fonts.cyri.scale(17))
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
@ -834,7 +832,7 @@ impl CharSelectionUi {
|
|||||||
.w_h(386.0, 80.0)
|
.w_h(386.0, 80.0)
|
||||||
.hover_image(self.imgs.selection_hover)
|
.hover_image(self.imgs.selection_hover)
|
||||||
.press_image(self.imgs.selection_press)
|
.press_image(self.imgs.selection_press)
|
||||||
.label(&self.voxygen_i18n.get("char_selection.create_new_charater"))
|
.label(&self.i18n.get("char_selection.create_new_charater"))
|
||||||
.label_color(color)
|
.label_color(color)
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.image_color(color)
|
.image_color(color)
|
||||||
@ -869,7 +867,7 @@ impl CharSelectionUi {
|
|||||||
.w_h(150.0, 40.0)
|
.w_h(150.0, 40.0)
|
||||||
.hover_image(self.imgs.button_hover)
|
.hover_image(self.imgs.button_hover)
|
||||||
.press_image(self.imgs.button_press)
|
.press_image(self.imgs.button_press)
|
||||||
.label(&self.voxygen_i18n.get("common.back"))
|
.label(&self.i18n.get("common.back"))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
.label_font_size(self.fonts.cyri.scale(20))
|
.label_font_size(self.fonts.cyri.scale(20))
|
||||||
@ -893,7 +891,7 @@ impl CharSelectionUi {
|
|||||||
} else {
|
} else {
|
||||||
self.imgs.button
|
self.imgs.button
|
||||||
})
|
})
|
||||||
.label(&self.voxygen_i18n.get("common.create"))
|
.label(&self.i18n.get("common.create"))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_color(if *name != "Character Name" && *name != "" {
|
.label_color(if *name != "Character Name" && *name != "" {
|
||||||
TEXT_COLOR
|
TEXT_COLOR
|
||||||
@ -908,7 +906,7 @@ impl CharSelectionUi {
|
|||||||
if create_button
|
if create_button
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("char_selection.create_info_name"),
|
&self.i18n.get("char_selection.create_info_name"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1081,7 +1079,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.icon_border_press)
|
.press_image(self.imgs.icon_border_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.species.human"),
|
&self.i18n.get("common.species.human"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1108,7 +1106,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.icon_border_press)
|
.press_image(self.imgs.icon_border_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.species.orc"),
|
&self.i18n.get("common.species.orc"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1134,7 +1132,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.icon_border_press)
|
.press_image(self.imgs.icon_border_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.species.dwarf"),
|
&self.i18n.get("common.species.dwarf"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1160,7 +1158,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.icon_border_press)
|
.press_image(self.imgs.icon_border_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.species.elf"),
|
&self.i18n.get("common.species.elf"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1187,7 +1185,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.icon_border_press)
|
.press_image(self.imgs.icon_border_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.species.undead"),
|
&self.i18n.get("common.species.undead"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1213,7 +1211,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.icon_border_press)
|
.press_image(self.imgs.icon_border_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.species.danari"),
|
&self.i18n.get("common.species.danari"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1239,7 +1237,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.icon_border_press)
|
.press_image(self.imgs.icon_border_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.weapons.sceptre"),
|
&self.i18n.get("common.weapons.sceptre"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1265,7 +1263,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.icon_border_press)
|
.press_image(self.imgs.icon_border_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.weapons.bow"),
|
&self.i18n.get("common.weapons.bow"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1290,7 +1288,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.icon_border_press)
|
.press_image(self.imgs.icon_border_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.weapons.staff"),
|
&self.i18n.get("common.weapons.staff"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1315,7 +1313,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.icon_border_press)
|
.press_image(self.imgs.icon_border_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.weapons.sword"),
|
&self.i18n.get("common.weapons.sword"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1341,7 +1339,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.icon_border_press)
|
.press_image(self.imgs.icon_border_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.weapons.hammer"),
|
&self.i18n.get("common.weapons.hammer"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1367,7 +1365,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.icon_border_press)
|
.press_image(self.imgs.icon_border_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.weapons.axe"),
|
&self.i18n.get("common.weapons.axe"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1385,7 +1383,7 @@ impl CharSelectionUi {
|
|||||||
.press_image(self.imgs.dice_press)
|
.press_image(self.imgs.dice_press)
|
||||||
.with_tooltip(
|
.with_tooltip(
|
||||||
tooltip_manager,
|
tooltip_manager,
|
||||||
&self.voxygen_i18n.get("common.rand_appearance"),
|
&self.i18n.get("common.rand_appearance"),
|
||||||
"",
|
"",
|
||||||
&tooltip_human,
|
&tooltip_human,
|
||||||
TEXT_COLOR,
|
TEXT_COLOR,
|
||||||
@ -1436,7 +1434,7 @@ impl CharSelectionUi {
|
|||||||
// Hair Style
|
// Hair Style
|
||||||
if let Some(new_val) = char_slider(
|
if let Some(new_val) = char_slider(
|
||||||
self.ids.creation_buttons_alignment_2,
|
self.ids.creation_buttons_alignment_2,
|
||||||
self.voxygen_i18n.get("char_selection.hair_style"),
|
self.i18n.get("char_selection.hair_style"),
|
||||||
self.ids.hairstyle_text,
|
self.ids.hairstyle_text,
|
||||||
body.species.num_hair_styles(body.body_type) as usize - 1,
|
body.species.num_hair_styles(body.body_type) as usize - 1,
|
||||||
body.hair_style as usize,
|
body.hair_style as usize,
|
||||||
@ -1448,7 +1446,7 @@ impl CharSelectionUi {
|
|||||||
// Hair Color
|
// Hair Color
|
||||||
if let Some(new_val) = char_slider(
|
if let Some(new_val) = char_slider(
|
||||||
self.ids.hairstyle_slider,
|
self.ids.hairstyle_slider,
|
||||||
self.voxygen_i18n.get("char_selection.hair_color"),
|
self.i18n.get("char_selection.hair_color"),
|
||||||
self.ids.haircolor_text,
|
self.ids.haircolor_text,
|
||||||
body.species.num_hair_colors() as usize - 1,
|
body.species.num_hair_colors() as usize - 1,
|
||||||
body.hair_color as usize,
|
body.hair_color as usize,
|
||||||
@ -1460,7 +1458,7 @@ impl CharSelectionUi {
|
|||||||
// Skin
|
// Skin
|
||||||
if let Some(new_val) = char_slider(
|
if let Some(new_val) = char_slider(
|
||||||
self.ids.haircolor_slider,
|
self.ids.haircolor_slider,
|
||||||
self.voxygen_i18n.get("char_selection.skin"),
|
self.i18n.get("char_selection.skin"),
|
||||||
self.ids.skin_text,
|
self.ids.skin_text,
|
||||||
body.species.num_skin_colors() as usize - 1,
|
body.species.num_skin_colors() as usize - 1,
|
||||||
body.skin as usize,
|
body.skin as usize,
|
||||||
@ -1472,7 +1470,7 @@ impl CharSelectionUi {
|
|||||||
// Eyebrows
|
// Eyebrows
|
||||||
if let Some(new_val) = char_slider(
|
if let Some(new_val) = char_slider(
|
||||||
self.ids.skin_slider,
|
self.ids.skin_slider,
|
||||||
self.voxygen_i18n.get("char_selection.eyeshape"),
|
self.i18n.get("char_selection.eyeshape"),
|
||||||
self.ids.eyebrows_text,
|
self.ids.eyebrows_text,
|
||||||
body.species.num_eyes(body.body_type) as usize - 1,
|
body.species.num_eyes(body.body_type) as usize - 1,
|
||||||
body.eyes as usize,
|
body.eyes as usize,
|
||||||
@ -1484,7 +1482,7 @@ impl CharSelectionUi {
|
|||||||
// EyeColor
|
// EyeColor
|
||||||
if let Some(new_val) = char_slider(
|
if let Some(new_val) = char_slider(
|
||||||
self.ids.eyebrows_slider,
|
self.ids.eyebrows_slider,
|
||||||
self.voxygen_i18n.get("char_selection.eye_color"),
|
self.i18n.get("char_selection.eye_color"),
|
||||||
self.ids.eyecolor_text,
|
self.ids.eyecolor_text,
|
||||||
body.species.num_eye_colors() as usize - 1,
|
body.species.num_eye_colors() as usize - 1,
|
||||||
body.eye_color as usize,
|
body.eye_color as usize,
|
||||||
@ -1497,7 +1495,7 @@ impl CharSelectionUi {
|
|||||||
let _current_accessory = body.accessory;
|
let _current_accessory = body.accessory;
|
||||||
if let Some(new_val) = char_slider(
|
if let Some(new_val) = char_slider(
|
||||||
self.ids.eyecolor_slider,
|
self.ids.eyecolor_slider,
|
||||||
self.voxygen_i18n.get("char_selection.accessories"),
|
self.i18n.get("char_selection.accessories"),
|
||||||
self.ids.accessories_text,
|
self.ids.accessories_text,
|
||||||
body.species.num_accessories(body.body_type) as usize - 1,
|
body.species.num_accessories(body.body_type) as usize - 1,
|
||||||
body.accessory as usize,
|
body.accessory as usize,
|
||||||
@ -1510,7 +1508,7 @@ impl CharSelectionUi {
|
|||||||
if body.species.num_beards(body.body_type) > 1 {
|
if body.species.num_beards(body.body_type) > 1 {
|
||||||
if let Some(new_val) = char_slider(
|
if let Some(new_val) = char_slider(
|
||||||
self.ids.accessories_slider,
|
self.ids.accessories_slider,
|
||||||
self.voxygen_i18n.get("char_selection.beard"),
|
self.i18n.get("char_selection.beard"),
|
||||||
self.ids.beard_text,
|
self.ids.beard_text,
|
||||||
body.species.num_beards(body.body_type) as usize - 1,
|
body.species.num_beards(body.body_type) as usize - 1,
|
||||||
body.beard as usize,
|
body.beard as usize,
|
||||||
@ -1520,7 +1518,7 @@ impl CharSelectionUi {
|
|||||||
body.beard = new_val as u8;
|
body.beard = new_val as u8;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Text::new(&self.voxygen_i18n.get("char_selection.beard"))
|
Text::new(&self.i18n.get("char_selection.beard"))
|
||||||
.mid_bottom_with_margin_on(self.ids.accessories_slider, -40.0)
|
.mid_bottom_with_margin_on(self.ids.accessories_slider, -40.0)
|
||||||
.font_size(self.fonts.cyri.scale(18))
|
.font_size(self.fonts.cyri.scale(18))
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
@ -1541,7 +1539,7 @@ impl CharSelectionUi {
|
|||||||
.expect("Unable to load armor!");
|
.expect("Unable to load armor!");
|
||||||
if let Some(new_val) = char_slider(
|
if let Some(new_val) = char_slider(
|
||||||
self.ids.beard_slider,
|
self.ids.beard_slider,
|
||||||
self.voxygen_i18n.get("char_selection.chest_color"),
|
self.i18n.get("char_selection.chest_color"),
|
||||||
self.ids.chest_text,
|
self.ids.chest_text,
|
||||||
armor.len() - 1,
|
armor.len() - 1,
|
||||||
armor
|
armor
|
||||||
|
@ -47,7 +47,7 @@ impl PlayState for MainMenuState {
|
|||||||
|
|
||||||
fn tick(&mut self, global_state: &mut GlobalState, events: Vec<Event>) -> PlayStateResult {
|
fn tick(&mut self, global_state: &mut GlobalState, events: Vec<Event>) -> PlayStateResult {
|
||||||
span!(_guard, "tick", "<MainMenuState as PlayState>::tick");
|
span!(_guard, "tick", "<MainMenuState as PlayState>::tick");
|
||||||
let localized_strings = crate::i18n::VoxygenLocalization::load_expect(
|
let localized_strings = crate::i18n::Localization::load_expect(
|
||||||
&crate::i18n::i18n_asset_key(&global_state.settings.language.selected_language),
|
&crate::i18n::i18n_asset_key(&global_state.settings.language.selected_language),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
i18n::{i18n_asset_key, VoxygenLocalization},
|
i18n::{i18n_asset_key, Localization},
|
||||||
render::Renderer,
|
render::Renderer,
|
||||||
ui::{
|
ui::{
|
||||||
self,
|
self,
|
||||||
fonts::ConrodVoxygenFonts,
|
fonts::Fonts,
|
||||||
ice::{Element, IcedUi},
|
ice::{Element, IcedUi},
|
||||||
img_ids::{BlankGraphic, ImageGraphic, VoxelGraphic},
|
img_ids::{BlankGraphic, ImageGraphic, VoxelGraphic},
|
||||||
Graphic, Ui,
|
Graphic, Ui,
|
||||||
@ -190,7 +190,7 @@ struct IcedState {
|
|||||||
}
|
}
|
||||||
pub type Message = Event;
|
pub type Message = Event;
|
||||||
impl IcedState {
|
impl IcedState {
|
||||||
pub fn view(&mut self) -> Element<Message> {
|
pub fn view(&mut self, i18n: &Localization) -> Element<Message> {
|
||||||
use iced::{Align, Column, Container, Length, Row, Space, Text};
|
use iced::{Align, Column, Container, Length, Row, Space, Text};
|
||||||
use ui::ice::{
|
use ui::ice::{
|
||||||
compound_graphic::{CompoundGraphic, Graphic},
|
compound_graphic::{CompoundGraphic, Graphic},
|
||||||
@ -206,13 +206,30 @@ impl IcedState {
|
|||||||
Text::new("Quit"),
|
Text::new("Quit"),
|
||||||
)
|
)
|
||||||
.into(), */
|
.into(), */
|
||||||
Text::new("Quit").size(20).into(),
|
Text::new(i18n.get("common.quit")).size(40).into(),
|
||||||
])
|
])
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.max_width(200)
|
.max_width(200)
|
||||||
.spacing(5)
|
.spacing(5)
|
||||||
.padding(10);
|
.padding(10);
|
||||||
|
|
||||||
|
// Quit
|
||||||
|
/*if Button::image(self.imgs.button)
|
||||||
|
.w_h(190.0, 40.0)
|
||||||
|
.bottom_left_with_margins_on(ui_widgets.window, 60.0, 30.0)
|
||||||
|
.hover_image(self.imgs.button_hover)
|
||||||
|
.press_image(self.imgs.button_press)
|
||||||
|
.label(i18n.get("common.quit"))
|
||||||
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
|
.label_color(TEXT_COLOR)
|
||||||
|
.label_font_size(self.fonts.cyri.scale(20))
|
||||||
|
.label_y(Relative::Scalar(3.0))
|
||||||
|
.set(self.ids.quit_button, ui_widgets)
|
||||||
|
.was_clicked()
|
||||||
|
{
|
||||||
|
events.push(Event::Quit);
|
||||||
|
}*/
|
||||||
|
|
||||||
let buttons = Container::new(buttons)
|
let buttons = Container::new(buttons)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
@ -331,8 +348,8 @@ pub struct MainMenuUi {
|
|||||||
time: f32,
|
time: f32,
|
||||||
anim_timer: f32,
|
anim_timer: f32,
|
||||||
bg_img_id: conrod_core::image::Id,
|
bg_img_id: conrod_core::image::Id,
|
||||||
voxygen_i18n: std::sync::Arc<VoxygenLocalization>,
|
i18n: std::sync::Arc<Localization>,
|
||||||
fonts: ConrodVoxygenFonts,
|
fonts: Fonts,
|
||||||
tip_no: u16,
|
tip_no: u16,
|
||||||
pub show_iced: bool,
|
pub show_iced: bool,
|
||||||
}
|
}
|
||||||
@ -376,21 +393,22 @@ impl<'a> MainMenuUi {
|
|||||||
));
|
));
|
||||||
//let chosen_tip = *tips.choose(&mut rng).unwrap();
|
//let chosen_tip = *tips.choose(&mut rng).unwrap();
|
||||||
// Load language
|
// Load language
|
||||||
let voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key(
|
let i18n = Localization::load_expect(&i18n_asset_key(
|
||||||
&global_state.settings.language.selected_language,
|
&global_state.settings.language.selected_language,
|
||||||
));
|
));
|
||||||
// Load fonts.
|
// Load fonts.
|
||||||
let fonts = ConrodVoxygenFonts::load(&voxygen_i18n.fonts, &mut ui)
|
let fonts = Fonts::load(&i18n.fonts, &mut ui).expect("Impossible to load fonts!");
|
||||||
.expect("Impossible to load fonts!");
|
|
||||||
|
|
||||||
// TODO: newtype Font
|
// TODO: newtype Font
|
||||||
let ice_font = {
|
let ice_font = {
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
common::assets::load_file("voxygen.font.OpenSans-Regular", &["ttf"])
|
common::assets::load_file("voxygen.font.haxrcorp_4089_cyrillic_altgr_extended", &[
|
||||||
.unwrap()
|
"ttf",
|
||||||
.read_to_end(&mut buf)
|
])
|
||||||
.unwrap();
|
.unwrap()
|
||||||
|
.read_to_end(&mut buf)
|
||||||
|
.unwrap();
|
||||||
glyph_brush::rusttype::Font::from_bytes(buf).unwrap()
|
glyph_brush::rusttype::Font::from_bytes(buf).unwrap()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -421,7 +439,7 @@ impl<'a> MainMenuUi {
|
|||||||
anim_timer: 0.0,
|
anim_timer: 0.0,
|
||||||
//show_disclaimer: global_state.settings.show_disclaimer,
|
//show_disclaimer: global_state.settings.show_disclaimer,
|
||||||
bg_img_id,
|
bg_img_id,
|
||||||
voxygen_i18n,
|
i18n,
|
||||||
fonts,
|
fonts,
|
||||||
tip_no: 0,
|
tip_no: 0,
|
||||||
show_iced: false,
|
show_iced: false,
|
||||||
@ -438,8 +456,8 @@ impl<'a> MainMenuUi {
|
|||||||
let (ref mut ui_widgets, ref mut _tooltip_manager) = self.ui.set_widgets();
|
let (ref mut ui_widgets, ref mut _tooltip_manager) = self.ui.set_widgets();
|
||||||
let tip_msg = format!(
|
let tip_msg = format!(
|
||||||
"{} {}",
|
"{} {}",
|
||||||
&self.voxygen_i18n.get("main.tip"),
|
&self.i18n.get("main.tip"),
|
||||||
&self.voxygen_i18n.get_variation("loading.tips", self.tip_no),
|
&self.i18n.get_variation("loading.tips", self.tip_no),
|
||||||
);
|
);
|
||||||
let tip_show = global_state.settings.gameplay.loading_tips;
|
let tip_show = global_state.settings.gameplay.loading_tips;
|
||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
@ -450,7 +468,7 @@ impl<'a> MainMenuUi {
|
|||||||
const TEXT_BG: Color = Color::Rgba(0.0, 0.0, 0.0, 1.0);
|
const TEXT_BG: Color = Color::Rgba(0.0, 0.0, 0.0, 1.0);
|
||||||
//const INACTIVE: Color = Color::Rgba(0.47, 0.47, 0.47, 0.47);
|
//const INACTIVE: Color = Color::Rgba(0.47, 0.47, 0.47, 0.47);
|
||||||
|
|
||||||
let intro_text = &self.voxygen_i18n.get("main.login_process");
|
let intro_text = &self.i18n.get("main.login_process");
|
||||||
|
|
||||||
// Tooltip
|
// Tooltip
|
||||||
/*let _tooltip = Tooltip::new({
|
/*let _tooltip = Tooltip::new({
|
||||||
@ -614,9 +632,9 @@ impl<'a> MainMenuUi {
|
|||||||
.press_image(self.imgs.button_press)
|
.press_image(self.imgs.button_press)
|
||||||
.label_y(Relative::Scalar(2.0))
|
.label_y(Relative::Scalar(2.0))
|
||||||
.label(match popup_type {
|
.label(match popup_type {
|
||||||
PopupType::Error => self.voxygen_i18n.get("common.okay"),
|
PopupType::Error => self.i18n.get("common.okay"),
|
||||||
PopupType::ConnectionInfo => self.voxygen_i18n.get("common.cancel"),
|
PopupType::ConnectionInfo => self.i18n.get("common.cancel"),
|
||||||
PopupType::AuthTrustPrompt(_) => self.voxygen_i18n.get("common.cancel"),
|
PopupType::AuthTrustPrompt(_) => self.i18n.get("common.cancel"),
|
||||||
})
|
})
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_font_size(self.fonts.cyri.scale(15))
|
.label_font_size(self.fonts.cyri.scale(15))
|
||||||
@ -652,7 +670,7 @@ impl<'a> MainMenuUi {
|
|||||||
{
|
{
|
||||||
events.push(Event::AuthServerTrust(auth_server.clone(), true));
|
events.push(Event::AuthServerTrust(auth_server.clone(), true));
|
||||||
change_popup = Some(Some(PopupData {
|
change_popup = Some(Some(PopupData {
|
||||||
msg: self.voxygen_i18n.get("main.connecting").into(),
|
msg: self.i18n.get("main.connecting").into(),
|
||||||
popup_type: PopupType::ConnectionInfo,
|
popup_type: PopupType::ConnectionInfo,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -690,13 +708,13 @@ impl<'a> MainMenuUi {
|
|||||||
.scroll_kids_vertically()
|
.scroll_kids_vertically()
|
||||||
.set(self.ids.disc_window, ui_widgets);
|
.set(self.ids.disc_window, ui_widgets);
|
||||||
|
|
||||||
Text::new(&self.voxygen_i18n.get("common.disclaimer"))
|
Text::new(&self.i18n.get("common.disclaimer"))
|
||||||
.top_left_with_margins_on(self.ids.disc_window, 30.0, 40.0)
|
.top_left_with_margins_on(self.ids.disc_window, 30.0, 40.0)
|
||||||
.font_size(self.fonts.cyri.scale(35))
|
.font_size(self.fonts.cyri.scale(35))
|
||||||
.font_id(self.fonts.alkhemi.conrod_id)
|
.font_id(self.fonts.alkhemi.conrod_id)
|
||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
.set(self.ids.disc_text_1, ui_widgets);
|
.set(self.ids.disc_text_1, ui_widgets);
|
||||||
Text::new(&self.voxygen_i18n.get("main.notice"))
|
Text::new(&self.i18n.get("main.notice"))
|
||||||
.top_left_with_margins_on(self.ids.disc_window, 110.0, 40.0)
|
.top_left_with_margins_on(self.ids.disc_window, 110.0, 40.0)
|
||||||
.font_size(self.fonts.cyri.scale(26))
|
.font_size(self.fonts.cyri.scale(26))
|
||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
@ -708,7 +726,7 @@ impl<'a> MainMenuUi {
|
|||||||
.hover_image(self.imgs.button_hover)
|
.hover_image(self.imgs.button_hover)
|
||||||
.press_image(self.imgs.button_press)
|
.press_image(self.imgs.button_press)
|
||||||
.label_y(Relative::Scalar(2.0))
|
.label_y(Relative::Scalar(2.0))
|
||||||
.label(&self.voxygen_i18n.get("common.accept"))
|
.label(&self.i18n.get("common.accept"))
|
||||||
.label_font_size(self.fonts.cyri.scale(22))
|
.label_font_size(self.fonts.cyri.scale(22))
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
@ -727,7 +745,7 @@ impl<'a> MainMenuUi {
|
|||||||
self.connect = true;
|
self.connect = true;
|
||||||
self.connecting = Some(std::time::Instant::now());
|
self.connecting = Some(std::time::Instant::now());
|
||||||
self.popup = Some(PopupData {
|
self.popup = Some(PopupData {
|
||||||
msg: [self.voxygen_i18n.get("main.connecting"), "..."].concat(),
|
msg: [self.i18n.get("main.connecting"), "..."].concat(),
|
||||||
popup_type: PopupType::ConnectionInfo,
|
popup_type: PopupType::ConnectionInfo,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -764,7 +782,7 @@ impl<'a> MainMenuUi {
|
|||||||
self.connect = true;
|
self.connect = true;
|
||||||
self.connecting = Some(std::time::Instant::now());
|
self.connecting = Some(std::time::Instant::now());
|
||||||
self.popup = Some(PopupData {
|
self.popup = Some(PopupData {
|
||||||
msg: [self.voxygen_i18n.get(""), ""].concat(),
|
msg: [self.i18n.get(""), ""].concat(),
|
||||||
popup_type: PopupType::ConnectionInfo,
|
popup_type: PopupType::ConnectionInfo,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -893,7 +911,7 @@ impl<'a> MainMenuUi {
|
|||||||
.hover_image(self.imgs.button_hover)
|
.hover_image(self.imgs.button_hover)
|
||||||
.press_image(self.imgs.button_press)
|
.press_image(self.imgs.button_press)
|
||||||
.label_y(Relative::Scalar(2.0))
|
.label_y(Relative::Scalar(2.0))
|
||||||
.label(&self.voxygen_i18n.get("common.close"))
|
.label(&self.i18n.get("common.close"))
|
||||||
.label_font_size(self.fonts.cyri.scale(20))
|
.label_font_size(self.fonts.cyri.scale(20))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
@ -942,7 +960,7 @@ impl<'a> MainMenuUi {
|
|||||||
.w_h(258.0*scale, 55.0*scale)
|
.w_h(258.0*scale, 55.0*scale)
|
||||||
.down_from(self.ids.address_bg, 20.0*scale)
|
.down_from(self.ids.address_bg, 20.0*scale)
|
||||||
.align_middle_x_of(self.ids.address_bg)
|
.align_middle_x_of(self.ids.address_bg)
|
||||||
.label(&self.voxygen_i18n.get("common.multiplayer"))
|
.label(&self.i18n.get("common.multiplayer"))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
.label_font_size(self.fonts.cyri.scale(18))
|
.label_font_size(self.fonts.cyri.scale(18))
|
||||||
@ -970,7 +988,7 @@ impl<'a> MainMenuUi {
|
|||||||
.w_h(258.0 * scale, 55.0 * scale)
|
.w_h(258.0 * scale, 55.0 * scale)
|
||||||
.down_from(self.ids.login_button, 20.0 * scale)
|
.down_from(self.ids.login_button, 20.0 * scale)
|
||||||
.align_middle_x_of(self.ids.address_bg)
|
.align_middle_x_of(self.ids.address_bg)
|
||||||
.label(&self.voxygen_i18n.get("common.singleplayer"))
|
.label(&self.i18n.get("common.singleplayer"))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
.label_font_size(self.fonts.cyri.scale(18))
|
.label_font_size(self.fonts.cyri.scale(18))
|
||||||
@ -989,7 +1007,7 @@ impl<'a> MainMenuUi {
|
|||||||
.bottom_left_with_margins_on(ui_widgets.window, 60.0 * scale, 30.0 * scale)
|
.bottom_left_with_margins_on(ui_widgets.window, 60.0 * scale, 30.0 * scale)
|
||||||
.hover_image(self.imgs.button_hover)
|
.hover_image(self.imgs.button_hover)
|
||||||
.press_image(self.imgs.button_press)
|
.press_image(self.imgs.button_press)
|
||||||
.label(&self.voxygen_i18n.get("common.quit"))
|
.label(&self.i18n.get("common.quit"))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
.label_font_size(self.fonts.cyri.scale(16))
|
.label_font_size(self.fonts.cyri.scale(16))
|
||||||
@ -1006,7 +1024,7 @@ impl<'a> MainMenuUi {
|
|||||||
.up_from(self.ids.quit_button, 8.0*scale)
|
.up_from(self.ids.quit_button, 8.0*scale)
|
||||||
//.hover_image(self.imgs.button_hover)
|
//.hover_image(self.imgs.button_hover)
|
||||||
//.press_image(self.imgs.button_press)
|
//.press_image(self.imgs.button_press)
|
||||||
.label(&self.voxygen_i18n.get("common.settings"))
|
.label(&self.i18n.get("common.settings"))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_color(TEXT_COLOR_2)
|
.label_color(TEXT_COLOR_2)
|
||||||
.label_font_size(self.fonts.cyri.scale(16))
|
.label_font_size(self.fonts.cyri.scale(16))
|
||||||
@ -1023,7 +1041,7 @@ impl<'a> MainMenuUi {
|
|||||||
.up_from(self.ids.settings_button, 8.0 * scale)
|
.up_from(self.ids.settings_button, 8.0 * scale)
|
||||||
.hover_image(self.imgs.button_hover)
|
.hover_image(self.imgs.button_hover)
|
||||||
.press_image(self.imgs.button_press)
|
.press_image(self.imgs.button_press)
|
||||||
.label(&self.voxygen_i18n.get("common.servers"))
|
.label(&self.i18n.get("common.servers"))
|
||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
.label_font_size(self.fonts.cyri.scale(16))
|
.label_font_size(self.fonts.cyri.scale(16))
|
||||||
@ -1079,8 +1097,10 @@ impl<'a> MainMenuUi {
|
|||||||
pub fn maintain(&mut self, global_state: &mut GlobalState, dt: Duration) -> Vec<Event> {
|
pub fn maintain(&mut self, global_state: &mut GlobalState, dt: Duration) -> Vec<Event> {
|
||||||
let events = self.update_layout(global_state, dt);
|
let events = self.update_layout(global_state, dt);
|
||||||
self.ui.maintain(global_state.window.renderer_mut(), None);
|
self.ui.maintain(global_state.window.renderer_mut(), None);
|
||||||
self.ice_ui
|
self.ice_ui.maintain(
|
||||||
.maintain(self.ice_state.view(), global_state.window.renderer_mut());
|
self.ice_state.view(&self.i18n),
|
||||||
|
global_state.window.renderer_mut(),
|
||||||
|
);
|
||||||
events
|
events
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ use crate::{
|
|||||||
audio::sfx::{SfxEvent, SfxEventItem},
|
audio::sfx::{SfxEvent, SfxEventItem},
|
||||||
ecs::MyEntity,
|
ecs::MyEntity,
|
||||||
hud::{DebugInfo, Event as HudEvent, Hud, HudInfo, PressBehavior},
|
hud::{DebugInfo, Event as HudEvent, Hud, HudInfo, PressBehavior},
|
||||||
i18n::{i18n_asset_key, VoxygenLocalization},
|
i18n::{i18n_asset_key, Localization},
|
||||||
key_state::KeyState,
|
key_state::KeyState,
|
||||||
menu::char_selection::CharSelectionState,
|
menu::char_selection::CharSelectionState,
|
||||||
render::Renderer,
|
render::Renderer,
|
||||||
@ -46,7 +46,7 @@ pub struct SessionState {
|
|||||||
key_state: KeyState,
|
key_state: KeyState,
|
||||||
inputs: comp::ControllerInputs,
|
inputs: comp::ControllerInputs,
|
||||||
selected_block: Block,
|
selected_block: Block,
|
||||||
voxygen_i18n: std::sync::Arc<VoxygenLocalization>,
|
i18n: std::sync::Arc<Localization>,
|
||||||
walk_forward_dir: Vec2<f32>,
|
walk_forward_dir: Vec2<f32>,
|
||||||
walk_right_dir: Vec2<f32>,
|
walk_right_dir: Vec2<f32>,
|
||||||
freefly_vel: Vec3<f32>,
|
freefly_vel: Vec3<f32>,
|
||||||
@ -72,7 +72,7 @@ impl SessionState {
|
|||||||
.camera_mut()
|
.camera_mut()
|
||||||
.set_fov_deg(global_state.settings.graphics.fov);
|
.set_fov_deg(global_state.settings.graphics.fov);
|
||||||
let hud = Hud::new(global_state, &client.borrow());
|
let hud = Hud::new(global_state, &client.borrow());
|
||||||
let voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key(
|
let i18n = Localization::load_expect(&i18n_asset_key(
|
||||||
&global_state.settings.language.selected_language,
|
&global_state.settings.language.selected_language,
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ impl SessionState {
|
|||||||
inputs: comp::ControllerInputs::default(),
|
inputs: comp::ControllerInputs::default(),
|
||||||
hud,
|
hud,
|
||||||
selected_block: Block::new(BlockKind::Misc, Rgb::broadcast(255)),
|
selected_block: Block::new(BlockKind::Misc, Rgb::broadcast(255)),
|
||||||
voxygen_i18n,
|
i18n,
|
||||||
walk_forward_dir,
|
walk_forward_dir,
|
||||||
walk_right_dir,
|
walk_right_dir,
|
||||||
freefly_vel: Vec3::zero(),
|
freefly_vel: Vec3::zero(),
|
||||||
@ -131,14 +131,14 @@ impl SessionState {
|
|||||||
match inv_event {
|
match inv_event {
|
||||||
InventoryUpdateEvent::CollectFailed => {
|
InventoryUpdateEvent::CollectFailed => {
|
||||||
self.hud.new_message(ChatMsg {
|
self.hud.new_message(ChatMsg {
|
||||||
message: self.voxygen_i18n.get("hud.chat.loot_fail").to_string(),
|
message: self.i18n.get("hud.chat.loot_fail").to_string(),
|
||||||
chat_type: ChatType::CommandError,
|
chat_type: ChatType::CommandError,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
InventoryUpdateEvent::Collected(item) => {
|
InventoryUpdateEvent::Collected(item) => {
|
||||||
self.hud.new_message(ChatMsg {
|
self.hud.new_message(ChatMsg {
|
||||||
message: self
|
message: self
|
||||||
.voxygen_i18n
|
.i18n
|
||||||
.get("hud.chat.loot_msg")
|
.get("hud.chat.loot_msg")
|
||||||
.replace("{item}", item.name()),
|
.replace("{item}", item.name()),
|
||||||
chat_type: ChatType::Loot,
|
chat_type: ChatType::Loot,
|
||||||
@ -150,9 +150,9 @@ impl SessionState {
|
|||||||
client::Event::Disconnect => return Ok(TickAction::Disconnect),
|
client::Event::Disconnect => return Ok(TickAction::Disconnect),
|
||||||
client::Event::DisconnectionNotification(time) => {
|
client::Event::DisconnectionNotification(time) => {
|
||||||
let message = match time {
|
let message = match time {
|
||||||
0 => String::from(self.voxygen_i18n.get("hud.chat.goodbye")),
|
0 => String::from(self.i18n.get("hud.chat.goodbye")),
|
||||||
_ => self
|
_ => self
|
||||||
.voxygen_i18n
|
.i18n
|
||||||
.get("hud.chat.connection_lost")
|
.get("hud.chat.connection_lost")
|
||||||
.replace("{time}", time.to_string().as_str()),
|
.replace("{time}", time.to_string().as_str()),
|
||||||
};
|
};
|
||||||
@ -165,7 +165,7 @@ impl SessionState {
|
|||||||
client::Event::Kicked(reason) => {
|
client::Event::Kicked(reason) => {
|
||||||
global_state.info_message = Some(format!(
|
global_state.info_message = Some(format!(
|
||||||
"{}: {}",
|
"{}: {}",
|
||||||
self.voxygen_i18n.get("main.login.kicked").to_string(),
|
self.i18n.get("main.login.kicked").to_string(),
|
||||||
reason
|
reason
|
||||||
));
|
));
|
||||||
return Ok(TickAction::Disconnect);
|
return Ok(TickAction::Disconnect);
|
||||||
@ -207,7 +207,7 @@ impl PlayState for SessionState {
|
|||||||
span!(_guard, "tick", "<Session as PlayState>::tick");
|
span!(_guard, "tick", "<Session as PlayState>::tick");
|
||||||
// TODO: let mut client = self.client.borrow_mut();
|
// TODO: let mut client = self.client.borrow_mut();
|
||||||
// NOTE: Not strictly necessary, but useful for hotloading translation changes.
|
// NOTE: Not strictly necessary, but useful for hotloading translation changes.
|
||||||
self.voxygen_i18n = VoxygenLocalization::load_expect(&i18n_asset_key(
|
self.i18n = Localization::load_expect(&i18n_asset_key(
|
||||||
&global_state.settings.language.selected_language,
|
&global_state.settings.language.selected_language,
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -673,7 +673,7 @@ impl PlayState for SessionState {
|
|||||||
Ok(TickAction::Disconnect) => return PlayStateResult::Pop, // Go to main menu
|
Ok(TickAction::Disconnect) => return PlayStateResult::Pop, // Go to main menu
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
global_state.info_message =
|
global_state.info_message =
|
||||||
Some(self.voxygen_i18n.get("common.connection_lost").to_owned());
|
Some(self.i18n.get("common.connection_lost").to_owned());
|
||||||
error!("[session] Failed to tick the scene: {:?}", err);
|
error!("[session] Failed to tick the scene: {:?}", err);
|
||||||
|
|
||||||
return PlayStateResult::Pop;
|
return PlayStateResult::Pop;
|
||||||
@ -752,7 +752,7 @@ impl PlayState for SessionState {
|
|||||||
// Look for changes in the localization files
|
// Look for changes in the localization files
|
||||||
if global_state.localization_watcher.reloaded() {
|
if global_state.localization_watcher.reloaded() {
|
||||||
hud_events.push(HudEvent::ChangeLanguage(Box::new(
|
hud_events.push(HudEvent::ChangeLanguage(Box::new(
|
||||||
self.voxygen_i18n.metadata.clone(),
|
self.i18n.metadata.clone(),
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -980,13 +980,13 @@ impl PlayState for SessionState {
|
|||||||
HudEvent::ChangeLanguage(new_language) => {
|
HudEvent::ChangeLanguage(new_language) => {
|
||||||
global_state.settings.language.selected_language =
|
global_state.settings.language.selected_language =
|
||||||
new_language.language_identifier;
|
new_language.language_identifier;
|
||||||
self.voxygen_i18n = VoxygenLocalization::load_watched(
|
self.i18n = Localization::load_watched(
|
||||||
&i18n_asset_key(&global_state.settings.language.selected_language),
|
&i18n_asset_key(&global_state.settings.language.selected_language),
|
||||||
&mut global_state.localization_watcher,
|
&mut global_state.localization_watcher,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
self.voxygen_i18n.log_missing_entries();
|
self.i18n.log_missing_entries();
|
||||||
self.hud.update_language(Arc::clone(&self.voxygen_i18n));
|
self.hud.update_language(Arc::clone(&self.i18n));
|
||||||
},
|
},
|
||||||
HudEvent::ChangeFullscreenMode(new_fullscreen_settings) => {
|
HudEvent::ChangeFullscreenMode(new_fullscreen_settings) => {
|
||||||
global_state
|
global_state
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
use crate::i18n::{Font, VoxygenFonts};
|
use crate::i18n;
|
||||||
use common::assets::Asset;
|
use common::assets::Asset;
|
||||||
|
|
||||||
pub struct ConrodVoxygenFont {
|
pub struct Font {
|
||||||
metadata: Font,
|
metadata: i18n::Font,
|
||||||
pub conrod_id: conrod_core::text::font::Id,
|
pub conrod_id: conrod_core::text::font::Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConrodVoxygenFont {
|
impl Font {
|
||||||
#[allow(clippy::needless_return)] // TODO: Pending review in #587
|
#[allow(clippy::needless_return)] // TODO: Pending review in #587
|
||||||
pub fn new(font: &Font, ui: &mut crate::ui::Ui) -> ConrodVoxygenFont {
|
pub fn new(font: &i18n::Font, ui: &mut crate::ui::Ui) -> Font {
|
||||||
return Self {
|
return Self {
|
||||||
metadata: font.clone(),
|
metadata: font.clone(),
|
||||||
conrod_id: ui.new_font(crate::ui::Font::load_expect(&font.asset_key)),
|
conrod_id: ui.new_font(crate::ui::Font::load_expect(&font.asset_key)),
|
||||||
@ -22,14 +22,14 @@ impl ConrodVoxygenFont {
|
|||||||
macro_rules! conrod_fonts {
|
macro_rules! conrod_fonts {
|
||||||
($([ $( $name:ident$(,)? )* ])*) => {
|
($([ $( $name:ident$(,)? )* ])*) => {
|
||||||
$(
|
$(
|
||||||
pub struct ConrodVoxygenFonts {
|
pub struct Fonts {
|
||||||
$(pub $name: ConrodVoxygenFont,)*
|
$(pub $name: Font,)*
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConrodVoxygenFonts {
|
impl Fonts {
|
||||||
pub fn load(voxygen_fonts: &VoxygenFonts, ui: &mut crate::ui::Ui) -> Result<Self, common::assets::Error> {
|
pub fn load(fonts: &i18n::Fonts, ui: &mut crate::ui::Ui) -> Result<Self, common::assets::Error> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
$( $name: ConrodVoxygenFont::new(voxygen_fonts.get(stringify!($name)).unwrap(), ui),)*
|
$( $name: Font::new(fonts.get(stringify!($name)).unwrap(), ui),)*
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user