Loot ChatType, Update german translation, map zooming

This commit is contained in:
Monty Marz 2020-07-01 19:05:44 +00:00
parent f9a7dbaa77
commit 89400264dc
20 changed files with 158 additions and 51 deletions

View File

@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added regional, local, and global chat (`/region`, `/say`, and `/world`, respectively) - Added regional, local, and global chat (`/region`, `/say`, and `/world`, respectively)
- Added command shortcuts for each of the above chat modes (`/g`, `/f`, `/r`, `/s`, and `/w`, respectively and `/t` for `/tell`) - Added command shortcuts for each of the above chat modes (`/g`, `/f`, `/r`, `/s`, and `/w`, respectively and `/t` for `/tell`)
- Ability to wield 2 × 1h weapons and shields (Note: 1h weapons & shields are not currently avaliable, see [!1095](https://gitlab.com/veloren/veloren/-/merge_requests/1095) for more info) - Ability to wield 2 × 1h weapons and shields (Note: 1h weapons & shields are not currently avaliable, see [!1095](https://gitlab.com/veloren/veloren/-/merge_requests/1095) for more info)
- Zoomable Map
### Changed ### Changed

BIN
assets/voxygen/element/icons/chat/loot_small.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/slider/indicator.png (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/element/slider/indicator_round.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/slider/track.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/slider/track.vox (Stored with Git LFS)

Binary file not shown.

View File

@ -138,6 +138,7 @@ eurer erstellen Charaktere gespeichert."#,
"main.login.failed_sending_request": "Authentifizierung fehlgeschlagen", "main.login.failed_sending_request": "Authentifizierung fehlgeschlagen",
"main.login.invalid_character": "Ungültiger Charakter", "main.login.invalid_character": "Ungültiger Charakter",
"main.login.client_crashed": "Client abgestürzt", "main.login.client_crashed": "Client abgestürzt",
"main.login.not_on_whitelist": "Ihr braucht einen Whitelist Eintrag durch den Server Admin",
/// End Main screen section /// End Main screen section
@ -154,6 +155,18 @@ eurer erstellen Charaktere gespeichert."#,
"hud.press_key_to_toggle_keybindings_fmt": "Drückt {key} um die Tastenbelegung zu zeigen", "hud.press_key_to_toggle_keybindings_fmt": "Drückt {key} um die Tastenbelegung zu zeigen",
"hud.press_key_to_toggle_debug_info_fmt": "Drückt {key} um die Debug-Info zu zeigen", "hud.press_key_to_toggle_debug_info_fmt": "Drückt {key} um die Debug-Info zu zeigen",
// Chat outputs
"hud.chat.online_msg": "[{name}] ist jetzt online.",
"hud.chat.offline_msg": "{name} ist jetzt offline.",
"hud.chat.loot_msg": "Ihr erhaltet [{item}]",
"hud.chat.loot_fail": "Euer Inventar ist voll!",
"hud.chat.goodbye": "Verbindung getrennt.",
"hud.chat.connection_lost": "Verbindung unterbrochen. Trenne Verbindung in {time} sekunden.",
// SCT outputs
"hud.sct.experience": "{amount} Erf",
"hud.sct.block": "GEBLOCKT",
/// Respawn message /// Respawn message
"hud.press_key_to_respawn": r#"Drückt {key} um am letzten Lagerfeuer wiederbelebt zu werden."#, "hud.press_key_to_respawn": r#"Drückt {key} um am letzten Lagerfeuer wiederbelebt zu werden."#,
@ -252,12 +265,15 @@ magischen Gegenstände ergattern?"#,
"hud.settings.cumulated_damage": "Addierter Schaden", "hud.settings.cumulated_damage": "Addierter Schaden",
"hud.settings.incoming_damage": "Erlittener Schaden", "hud.settings.incoming_damage": "Erlittener Schaden",
"hud.settings.cumulated_incoming_damage": "Addierter erlittener Schaden", "hud.settings.cumulated_incoming_damage": "Addierter erlittener Schaden",
"hud.settings.speech_bubble": "Sprechblase",
"hud.settings.speech_bubble_dark_mode": "Dunkle Sprechblasen", "hud.settings.speech_bubble_dark_mode": "Dunkle Sprechblasen",
"hud.settings.speech_bubble_icon": "Sprechblasen Symbole",
"hud.settings.energybar_numbers": "Zahlen auf Ressourcenanzeige", "hud.settings.energybar_numbers": "Zahlen auf Ressourcenanzeige",
"hud.settings.values": "Werte", "hud.settings.values": "Werte",
"hud.settings.percentages": "Prozent", "hud.settings.percentages": "Prozent",
"hud.settings.chat": "Chat", "hud.settings.chat": "Chat",
"hud.settings.background_transparency": "Hintergrund Kontrast", "hud.settings.background_transparency": "Hintergrund Kontrast",
"hud.settings.chat_character_name": "Character Namen im Chat",
"hud.settings.pan_sensitivity": "Schwenk Sensibilität", "hud.settings.pan_sensitivity": "Schwenk Sensibilität",
"hud.settings.zoom_sensitivity": "Zoom Sensibilität", "hud.settings.zoom_sensitivity": "Zoom Sensibilität",
@ -265,6 +281,8 @@ magischen Gegenstände ergattern?"#,
"hud.settings.invert_mouse_y_axis": "Maus Y-Achse invertieren", "hud.settings.invert_mouse_y_axis": "Maus Y-Achse invertieren",
"hud.settings.enable_mouse_smoothing": "Kamera Glättung", "hud.settings.enable_mouse_smoothing": "Kamera Glättung",
"hud.settings.free_look_behavior": "Freies Umsehen", "hud.settings.free_look_behavior": "Freies Umsehen",
"hud.settings.auto_walk_behavior": "Automatisches Laufen",
"hud.settings.stop_auto_walk_on_input": "Auto-Laufen bei Tastendruck stoppen",
"hud.settings.view_distance": "Gelände Sichtweite", "hud.settings.view_distance": "Gelände Sichtweite",
"hud.settings.sprites_view_distance": "Objekt Sichtweite", "hud.settings.sprites_view_distance": "Objekt Sichtweite",
@ -297,6 +315,7 @@ magischen Gegenstände ergattern?"#,
"hud.spell": "Zauber", "hud.spell": "Zauber",
"hud.free_look_indicator": "Freie Sicht aktiv", "hud.free_look_indicator": "Freie Sicht aktiv",
"hud.auto_walk_indicator": "Automatisches Laufen aktiv",
/// End HUD section /// End HUD section

View File

@ -138,7 +138,7 @@ https://account.veloren.net."#,
"main.login.failed_sending_request": "Request to Auth server failed", "main.login.failed_sending_request": "Request to Auth server failed",
"main.login.invalid_character": "The selected character is invalid", "main.login.invalid_character": "The selected character is invalid",
"main.login.client_crashed": "Client crashed", "main.login.client_crashed": "Client crashed",
"main.login.not_on_whitelist": "You are not on the whitelist. Contact Server Owner if you want to join.", "main.login.not_on_whitelist": "You need a Whitelist entry by an Admin to join",
/// End Main screen section /// End Main screen section
@ -155,6 +155,18 @@ https://account.veloren.net."#,
"hud.press_key_to_toggle_keybindings_fmt": "Press {key} to toggle keybindings", "hud.press_key_to_toggle_keybindings_fmt": "Press {key} to toggle keybindings",
"hud.press_key_to_toggle_debug_info_fmt": "Press {key} to toggle debug info", "hud.press_key_to_toggle_debug_info_fmt": "Press {key} to toggle debug info",
// Chat outputs
"hud.chat.online_msg": "[{name}] is now online.",
"hud.chat.offline_msg": "{name} went offline.",
"hud.chat.loot_msg": "You picked up [{item}]",
"hud.chat.loot_fail": "Your Inventory is full!",
"hud.chat.goodbye": "Goodbye!",
"hud.chat.connection_lost": "Connection lost. Kicking in {time} seconds.",
// SCT outputs
"hud.sct.experience": "{amount} Exp",
"hud.sct.block": "BLOCKED",
// Respawn message // Respawn message
"hud.press_key_to_respawn": r#"Press {key} to respawn at the last campfire you visited."#, "hud.press_key_to_respawn": r#"Press {key} to respawn at the last campfire you visited."#,
@ -260,7 +272,7 @@ magically infused items?"#,
"hud.settings.percentages": "Percentages", "hud.settings.percentages": "Percentages",
"hud.settings.chat": "Chat", "hud.settings.chat": "Chat",
"hud.settings.background_transparency": "Background Transparency", "hud.settings.background_transparency": "Background Transparency",
"hud.settings.chat_character_name": "Show Character Names", "hud.settings.chat_character_name": "Character Names in chat",
"hud.settings.pan_sensitivity": "Pan Sensitivity", "hud.settings.pan_sensitivity": "Pan Sensitivity",
"hud.settings.zoom_sensitivity": "Zoom Sensitivity", "hud.settings.zoom_sensitivity": "Zoom Sensitivity",

View File

@ -1045,6 +1045,7 @@ impl Client {
comp::ChatType::Offline => message.to_string(), comp::ChatType::Offline => message.to_string(),
comp::ChatType::CommandError => message.to_string(), comp::ChatType::CommandError => message.to_string(),
comp::ChatType::CommandInfo => message.to_string(), comp::ChatType::CommandInfo => message.to_string(),
comp::ChatType::Loot => message.to_string(),
comp::ChatType::FactionMeta(_) => message.to_string(), comp::ChatType::FactionMeta(_) => message.to_string(),
comp::ChatType::GroupMeta(_) => message.to_string(), comp::ChatType::GroupMeta(_) => message.to_string(),
comp::ChatType::Kill => message.to_string(), comp::ChatType::Kill => message.to_string(),

View File

@ -81,6 +81,8 @@ pub enum ChatType {
Npc(Uid, u16), Npc(Uid, u16),
/// Anything else /// Anything else
Meta, Meta,
// Looted items
Loot,
} }
impl ChatType { impl ChatType {
@ -134,6 +136,7 @@ impl ChatMsg {
ChatType::Offline => SpeechBubbleType::None, ChatType::Offline => SpeechBubbleType::None,
ChatType::CommandInfo => SpeechBubbleType::None, ChatType::CommandInfo => SpeechBubbleType::None,
ChatType::CommandError => SpeechBubbleType::None, ChatType::CommandError => SpeechBubbleType::None,
ChatType::Loot => SpeechBubbleType::None,
ChatType::FactionMeta(_) => SpeechBubbleType::None, ChatType::FactionMeta(_) => SpeechBubbleType::None,
ChatType::GroupMeta(_) => SpeechBubbleType::None, ChatType::GroupMeta(_) => SpeechBubbleType::None,
ChatType::Kill => SpeechBubbleType::None, ChatType::Kill => SpeechBubbleType::None,
@ -154,6 +157,7 @@ impl ChatMsg {
ChatType::Offline => None, ChatType::Offline => None,
ChatType::CommandInfo => None, ChatType::CommandInfo => None,
ChatType::CommandError => None, ChatType::CommandError => None,
ChatType::Loot => None,
ChatType::FactionMeta(_) => None, ChatType::FactionMeta(_) => None,
ChatType::GroupMeta(_) => None, ChatType::GroupMeta(_) => None,
ChatType::Kill => None, ChatType::Kill => None,

View File

@ -246,6 +246,7 @@ impl StateExt for State {
| comp::ChatType::Offline | comp::ChatType::Offline
| comp::ChatType::CommandInfo | comp::ChatType::CommandInfo
| comp::ChatType::CommandError | comp::ChatType::CommandError
| comp::ChatType::Loot
| comp::ChatType::Kill | comp::ChatType::Kill
| comp::ChatType::Meta | comp::ChatType::Meta
| comp::ChatType::World(_) => { | comp::ChatType::World(_) => {

View File

@ -272,7 +272,7 @@ impl<'a> System<'a> for Sys {
if !client.login_msg_sent { if !client.login_msg_sent {
new_chat_msgs.push((None, ChatMsg { new_chat_msgs.push((None, ChatMsg {
chat_type: ChatType::Online, chat_type: ChatType::Online,
message: format!("[{}] is now online.", &player.alias), message: format!("[{}] is now online.", &player.alias), // TODO: Localize this
})); }));
client.login_msg_sent = true; client.login_msg_sent = true;

View File

@ -1,6 +1,6 @@
use super::{ use super::{
img_ids::Imgs, ERROR_COLOR, FACTION_COLOR, GROUP_COLOR, INFO_COLOR, KILL_COLOR, OFFLINE_COLOR, img_ids::Imgs, ERROR_COLOR, FACTION_COLOR, GROUP_COLOR, INFO_COLOR, KILL_COLOR, LOOT_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::{ui::fonts::ConrodVoxygenFonts, GlobalState}; use crate::{ui::fonts::ConrodVoxygenFonts, GlobalState};
use client::{cmd, Client}; use client::{cmd, Client};
@ -479,6 +479,7 @@ fn render_chat_line(chat_type: &ChatType, imgs: &Imgs) -> (Color, conrod_core::i
ChatType::Offline => (OFFLINE_COLOR, imgs.chat_offline_small), ChatType::Offline => (OFFLINE_COLOR, imgs.chat_offline_small),
ChatType::CommandError => (ERROR_COLOR, imgs.chat_command_error_small), ChatType::CommandError => (ERROR_COLOR, imgs.chat_command_error_small),
ChatType::CommandInfo => (INFO_COLOR, imgs.chat_command_info_small), ChatType::CommandInfo => (INFO_COLOR, imgs.chat_command_info_small),
ChatType::Loot => (LOOT_COLOR, imgs.chat_loot_small),
ChatType::GroupMeta(_) => (GROUP_COLOR, imgs.chat_group_small), ChatType::GroupMeta(_) => (GROUP_COLOR, imgs.chat_group_small),
ChatType::FactionMeta(_) => (FACTION_COLOR, imgs.chat_faction_small), ChatType::FactionMeta(_) => (FACTION_COLOR, imgs.chat_faction_small),
ChatType::Kill => (KILL_COLOR, imgs.chat_kill_small), ChatType::Kill => (KILL_COLOR, imgs.chat_kill_small),

View File

@ -44,8 +44,6 @@ image_ids! {
settings_button_pressed: "voxygen.element.buttons.settings_button_pressed", settings_button_pressed: "voxygen.element.buttons.settings_button_pressed",
settings_button_hover: "voxygen.element.buttons.settings_button_hover", settings_button_hover: "voxygen.element.buttons.settings_button_hover",
settings_button_press: "voxygen.element.buttons.settings_button_press", settings_button_press: "voxygen.element.buttons.settings_button_press",
slider: "voxygen.element.slider.track",
slider_indicator: "voxygen.element.slider.indicator",
esc_frame: "voxygen.element.frames.esc_menu", esc_frame: "voxygen.element.frames.esc_menu",
// Chat-Arrows // Chat-Arrows
@ -95,6 +93,11 @@ image_ids! {
quest_bg: "voxygen.element.misc_bg.temp_quest_bg", quest_bg: "voxygen.element.misc_bg.temp_quest_bg",
// Slider
slider: "voxygen.element.slider.track",
slider_indicator: "voxygen.element.slider.indicator",
slider_indicator_small: "voxygen.element.slider.indicator_round",
// Buttons // Buttons
settings: "voxygen.element.buttons.settings", settings: "voxygen.element.buttons.settings",
@ -316,6 +319,7 @@ image_ids! {
chat_command_info_small: "voxygen.element.icons.chat.command_info_small", chat_command_info_small: "voxygen.element.icons.chat.command_info_small",
chat_online_small: "voxygen.element.icons.chat.online_small", chat_online_small: "voxygen.element.icons.chat.online_small",
chat_offline_small: "voxygen.element.icons.chat.offline_small", chat_offline_small: "voxygen.element.icons.chat.offline_small",
chat_loot_small: "voxygen.element.icons.chat.loot_small",
chat_faction: "voxygen.element.icons.chat.faction", chat_faction: "voxygen.element.icons.chat.faction",
chat_group: "voxygen.element.icons.chat.group", chat_group: "voxygen.element.icons.chat.group",

View File

@ -4,12 +4,13 @@ use super::{
}; };
use crate::{ use crate::{
i18n::VoxygenLocalization, i18n::VoxygenLocalization,
ui::{fonts::ConrodVoxygenFonts, img_ids}, ui::{fonts::ConrodVoxygenFonts, img_ids, ImageSlider},
GlobalState,
}; };
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::{
color, color, position,
widget::{self, Button, Image, Rectangle, Text}, widget::{self, Button, Image, Rectangle, Text},
widget_ids, Colorable, Positionable, Sizeable, Widget, WidgetCommon, widget_ids, Colorable, Positionable, Sizeable, Widget, WidgetCommon,
}; };
@ -29,6 +30,7 @@ widget_ids! {
grid, grid,
map_title, map_title,
qlog_title, qlog_title,
zoom_slider,
} }
} }
@ -44,6 +46,7 @@ pub struct Map<'a> {
common: widget::CommonBuilder, common: widget::CommonBuilder,
_pulse: f32, _pulse: f32,
localized_strings: &'a std::sync::Arc<VoxygenLocalization>, localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
global_state: &'a GlobalState,
} }
impl<'a> Map<'a> { impl<'a> Map<'a> {
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587 #[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
@ -56,6 +59,7 @@ impl<'a> Map<'a> {
fonts: &'a ConrodVoxygenFonts, fonts: &'a ConrodVoxygenFonts,
pulse: f32, pulse: f32,
localized_strings: &'a std::sync::Arc<VoxygenLocalization>, localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
global_state: &'a GlobalState,
) -> Self { ) -> Self {
Self { Self {
_show: show, _show: show,
@ -67,6 +71,7 @@ impl<'a> Map<'a> {
common: widget::CommonBuilder::default(), common: widget::CommonBuilder::default(),
_pulse: pulse, _pulse: pulse,
localized_strings, localized_strings,
global_state,
} }
} }
} }
@ -76,11 +81,12 @@ pub struct State {
} }
pub enum Event { pub enum Event {
MapZoom(f64),
Close, Close,
} }
impl<'a> Widget for Map<'a> { impl<'a> Widget for Map<'a> {
type Event = Option<Event>; type Event = Vec<Event>;
type State = State; type State = State;
type Style = (); type Style = ();
@ -96,7 +102,8 @@ impl<'a> Widget for Map<'a> {
#[allow(clippy::useless_format)] // TODO: Pending review in #587 #[allow(clippy::useless_format)] // TODO: Pending review in #587
fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event { fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event {
let widget::UpdateArgs { state, ui, .. } = args; let widget::UpdateArgs { state, ui, .. } = args;
let zoom = self.global_state.settings.gameplay.map_zoom * 0.8;
let mut events = Vec::new();
// Frame // Frame
Image::new(self.imgs.map_bg) Image::new(self.imgs.map_bg)
.w_h(1052.0, 886.0) .w_h(1052.0, 886.0)
@ -154,7 +161,7 @@ impl<'a> Widget for Map<'a> {
.set(state.ids.close, ui) .set(state.ids.close, ui)
.was_clicked() .was_clicked()
{ {
return Some(Event::Close); events.push(Event::Close);
} }
// Location Name // Location Name
@ -182,11 +189,6 @@ impl<'a> Widget for Map<'a> {
let (world_map, worldsize) = self.world_map; let (world_map, worldsize) = self.world_map;
let worldsize = worldsize.map2(TerrainChunkSize::RECT_SIZE, |e, f| e as f64 * f as f64); let worldsize = worldsize.map2(TerrainChunkSize::RECT_SIZE, |e, f| e as f64 * f as f64);
Image::new(world_map.none)
.mid_top_with_margin_on(state.ids.map_align, 10.0)
.w_h(760.0, 760.0)
.parent(state.ids.bg)
.set(state.ids.grid, ui);
// Coordinates // Coordinates
let player_pos = self let player_pos = self
.client .client
@ -195,27 +197,56 @@ impl<'a> Widget for Map<'a> {
.read_storage::<comp::Pos>() .read_storage::<comp::Pos>()
.get(self.client.entity()) .get(self.client.entity())
.map_or(Vec3::zero(), |pos| pos.0); .map_or(Vec3::zero(), |pos| pos.0);
let w_src = worldsize.x / TerrainChunkSize::RECT_SIZE.x as f64 / zoom;
let h_src = worldsize.y / TerrainChunkSize::RECT_SIZE.y as f64 / zoom;
let rect_src = position::Rect::from_xy_dim(
[
player_pos.x as f64 / TerrainChunkSize::RECT_SIZE.x as f64,
(worldsize.y - player_pos.y as f64) / TerrainChunkSize::RECT_SIZE.y as f64,
],
[w_src, h_src],
);
Image::new(world_map.none)
.mid_top_with_margin_on(state.ids.map_align, 10.0)
.w_h(760.0, 760.0)
.parent(state.ids.bg)
.source_rectangle(rect_src)
.set(state.ids.grid, ui);
if let Some(new_val) = ImageSlider::discrete(
self.global_state.settings.gameplay.map_zoom as i32,
1,
30,
self.imgs.slider_indicator_small,
self.imgs.slider,
)
.w_h(600.0, 22.0 * 2.0)
.mid_bottom_with_margin_on(state.ids.grid, -55.0)
.track_breadth(12.0 * 2.0)
.slider_length(22.0 * 2.0)
.pad_track((12.0, 12.0))
.set(state.ids.zoom_slider, ui)
{
events.push(Event::MapZoom(new_val as f64));
}
// Cursor pos relative to playerpos and widget size // Cursor pos relative to playerpos and widget size
// Cursor stops moving on an axis as soon as it's position exceeds the maximum // Cursor stops moving on an axis as soon as it's position exceeds the maximum
// size of the widget // // size of the widget
let rel = Vec2::from(player_pos).map2(worldsize, |e: f32, sz: f64| {
/*let rel = Vec2::from(player_pos).map2(worldsize, |e: f32, sz: f64| {
(e as f64 / sz).clamped(0.0, 1.0) (e as f64 / sz).clamped(0.0, 1.0)
}); });*/
let xy = rel * 760.0; //let xy = rel * 760.0;
let scale = 0.6; let scale = 0.6;
let arrow_sz = Vec2::new(32.0, 37.0) * scale; let arrow_sz = Vec2::new(32.0, 37.0) * scale;
Image::new(self.rot_imgs.indicator_mmap_small.target_north) Image::new(self.rot_imgs.indicator_mmap_small.target_north)
.bottom_left_with_margins_on( .middle_of(state.ids.grid)
state.ids.grid,
xy.y - arrow_sz.y / 2.0,
xy.x - arrow_sz.x / 2.0,
)
.w_h(arrow_sz.x, arrow_sz.y) .w_h(arrow_sz.x, arrow_sz.y)
.color(Some(UI_HIGHLIGHT_0)) .color(Some(UI_HIGHLIGHT_0))
.floating(true) .floating(true)
.parent(ui.window) .parent(ui.window)
.set(state.ids.indicator, ui); .set(state.ids.indicator, ui);
None events
} }
} }

View File

@ -99,6 +99,8 @@ const REGION_COLOR: Color = Color::Rgba(0.8, 1.0, 0.8, 1.0);
const KILL_COLOR: Color = Color::Rgba(1.0, 0.17, 0.17, 1.0); const KILL_COLOR: Color = Color::Rgba(1.0, 0.17, 0.17, 1.0);
/// Color for global messages /// Color for global messages
const WORLD_COLOR: Color = Color::Rgba(0.95, 1.0, 0.95, 1.0); const WORLD_COLOR: Color = Color::Rgba(0.95, 1.0, 0.95, 1.0);
/// Color for collected loot messages
const LOOT_COLOR: Color = Color::Rgba(0.69, 0.57, 1.0, 1.0);
// UI Color-Theme // UI Color-Theme
const UI_MAIN: Color = Color::Rgba(0.61, 0.70, 0.70, 1.0); // Greenish Blue const UI_MAIN: Color = Color::Rgba(0.61, 0.70, 0.70, 1.0); // Greenish Blue
@ -249,6 +251,7 @@ pub enum Event {
ChangeMaxFPS(u32), ChangeMaxFPS(u32),
ChangeFOV(u16), ChangeFOV(u16),
ChangeGamma(f32), ChangeGamma(f32),
MapZoom(f64),
AdjustWindowSize([u16; 2]), AdjustWindowSize([u16; 2]),
ToggleFullscreen, ToggleFullscreen,
ChangeAaMode(AaMode), ChangeAaMode(AaMode),
@ -360,7 +363,7 @@ impl Show {
fn map(&mut self, open: bool) { fn map(&mut self, open: bool) {
self.map = open; self.map = open;
self.bag = false; self.bag = false;
self.want_grab = true; self.want_grab = !open;
} }
fn social(&mut self, open: bool) { fn social(&mut self, open: bool) {
@ -1794,7 +1797,7 @@ impl Hud {
} }
// Map // Map
if self.show.map { if self.show.map {
match Map::new( for event in Map::new(
&self.show, &self.show,
client, client,
&self.imgs, &self.imgs,
@ -1803,14 +1806,19 @@ impl Hud {
&self.fonts, &self.fonts,
self.pulse, self.pulse,
&self.voxygen_i18n, &self.voxygen_i18n,
&global_state,
) )
.set(self.ids.map, ui_widgets) .set(self.ids.map, ui_widgets)
{ {
Some(map::Event::Close) => { match event {
map::Event::Close => {
self.show.map(false); self.show.map(false);
self.force_ungrab = true; self.force_ungrab = true;
}, },
None => {}, map::Event::MapZoom(map_zoom) => {
events.push(Event::MapZoom(map_zoom));
},
}
} }
} }

View File

@ -185,8 +185,6 @@ image_ids! {
selection: "voxygen.element.frames.selection", selection: "voxygen.element.frames.selection",
selection_hover: "voxygen.element.frames.selection_hover", selection_hover: "voxygen.element.frames.selection_hover",
selection_press: "voxygen.element.frames.selection_press", selection_press: "voxygen.element.frames.selection_press",
slider_range: "voxygen.element.slider.track",
slider_indicator: "voxygen.element.slider.indicator",
// Info Window // Info Window
info_frame: "voxygen.element.frames.info_frame", info_frame: "voxygen.element.frames.info_frame",
@ -200,6 +198,9 @@ image_ids! {
name_input: "voxygen.element.misc_bg.textbox_mid", name_input: "voxygen.element.misc_bg.textbox_mid",
slider_range: "voxygen.element.slider.track",
slider_indicator: "voxygen.element.slider.indicator",
// Tool Icons // Tool Icons
daggers: "voxygen.element.icons.daggers", daggers: "voxygen.element.icons.daggers",
sword: "voxygen.element.icons.sword", sword: "voxygen.element.icons.sword",

View File

@ -12,7 +12,7 @@ use crate::{
}; };
use client::{self, Client}; use client::{self, Client};
use common::{ use common::{
assets::{load_watched, watch}, assets::{load_expect, load_watched, watch},
clock::Clock, clock::Clock,
comp, comp,
comp::{ChatMsg, ChatType, InventoryUpdateEvent, Pos, Vel, MAX_PICKUP_RANGE_SQR}, comp::{ChatMsg, ChatType, InventoryUpdateEvent, Pos, Vel, MAX_PICKUP_RANGE_SQR},
@ -42,6 +42,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>,
} }
/// Represents an active game session (i.e., the one being played). /// Represents an active game session (i.e., the one being played).
@ -63,6 +64,9 @@ impl SessionState {
.ecs_mut() .ecs_mut()
.insert(MyEntity(my_entity)); .insert(MyEntity(my_entity));
} }
let voxygen_i18n = load_expect::<VoxygenLocalization>(&i18n_asset_key(
&global_state.settings.language.selected_language,
));
Self { Self {
scene, scene,
client, client,
@ -70,6 +74,7 @@ impl SessionState {
inputs: comp::ControllerInputs::default(), inputs: comp::ControllerInputs::default(),
hud, hud,
selected_block: Block::new(BlockKind::Normal, Rgb::broadcast(255)), selected_block: Block::new(BlockKind::Normal, Rgb::broadcast(255)),
voxygen_i18n,
} }
} }
} }
@ -81,6 +86,9 @@ impl SessionState {
let mut client = self.client.borrow_mut(); let mut client = self.client.borrow_mut();
for event in client.tick(self.inputs.clone(), dt, crate::ecs::sys::add_local_systems)? { for event in client.tick(self.inputs.clone(), dt, crate::ecs::sys::add_local_systems)? {
self.voxygen_i18n = load_expect::<VoxygenLocalization>(&i18n_asset_key(
&global_state.settings.language.selected_language,
));
match event { match event {
client::Event::Chat(m) => { client::Event::Chat(m) => {
self.hud.new_message(m); self.hud.new_message(m);
@ -96,16 +104,17 @@ impl SessionState {
match inv_event { match inv_event {
InventoryUpdateEvent::CollectFailed => { InventoryUpdateEvent::CollectFailed => {
self.hud.new_message(ChatMsg { self.hud.new_message(ChatMsg {
message: String::from( message: self.voxygen_i18n.get("hud.chat.loot_fail").to_string(),
"Failed to collect item. Your inventory may be full!",
),
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: format!("Picked up {}", item.name()), message: self
chat_type: ChatType::CommandInfo, .voxygen_i18n
.get("hud.chat.loot_msg")
.replace("{item}", item.name().to_string().as_str()),
chat_type: ChatType::Loot,
}); });
}, },
_ => {}, _ => {},
@ -114,8 +123,11 @@ 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("Goodbye!"), 0 => String::from(self.voxygen_i18n.get("hud.chat.goodbye")),
_ => format!("Connection lost. Kicking in {} seconds", time), _ => self
.voxygen_i18n
.get("hud.chat.connection_lost")
.replace("{time}", time.to_string().as_str()),
}; };
self.hud.new_message(ChatMsg { self.hud.new_message(ChatMsg {
@ -805,6 +817,10 @@ impl PlayState for SessionState {
.camera_mut() .camera_mut()
.compute_dependents(&*self.client.borrow().state().terrain()); .compute_dependents(&*self.client.borrow().state().terrain());
}, },
HudEvent::MapZoom(map_zoom) => {
global_state.settings.gameplay.map_zoom = map_zoom;
global_state.settings.save_to_file_warn();
},
HudEvent::ChangeGamma(new_gamma) => { HudEvent::ChangeGamma(new_gamma) => {
global_state.settings.graphics.gamma = new_gamma; global_state.settings.graphics.gamma = new_gamma;
global_state.settings.save_to_file_warn(); global_state.settings.save_to_file_warn();

View File

@ -473,6 +473,7 @@ pub struct GameplaySettings {
pub free_look_behavior: PressBehavior, pub free_look_behavior: PressBehavior,
pub auto_walk_behavior: PressBehavior, pub auto_walk_behavior: PressBehavior,
pub stop_auto_walk_on_input: bool, pub stop_auto_walk_on_input: bool,
pub map_zoom: f64,
} }
impl Default for GameplaySettings { impl Default for GameplaySettings {
@ -501,6 +502,7 @@ impl Default for GameplaySettings {
free_look_behavior: PressBehavior::Toggle, free_look_behavior: PressBehavior::Toggle,
auto_walk_behavior: PressBehavior::Toggle, auto_walk_behavior: PressBehavior::Toggle,
stop_auto_walk_on_input: true, stop_auto_walk_on_input: true,
map_zoom: 4.0,
} }
} }
} }