mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'evgenkot/loot-scroller-i18n' into 'master'
I18n loot_scroller See merge request veloren/veloren!4317
This commit is contained in:
commit
5ff40fdcfd
@ -81,7 +81,11 @@ hud-chat-chat_tab_hover_tooltip = Right click for settings
|
||||
|
||||
## HUD Pickup message
|
||||
|
||||
hud-loot-pickup-msg = { $amount ->
|
||||
[one] { $actor } picked up { $item }
|
||||
*[other] { $actor } picked up {$amount}x {$item}
|
||||
hud-loot-pickup-msg-you = { $amount ->
|
||||
[1] You picked up { $item }
|
||||
*[other] You picked up {$amount}x {$item}
|
||||
}
|
||||
hud-loot-pickup-msg = { $amount ->
|
||||
[1] { $actor } picked up { $item }
|
||||
*[other] { $actor } picked up { $amount }x { $item }
|
||||
}
|
@ -53,10 +53,19 @@ hud-chat-default_death_msg = { "[" }{ $name }] умер
|
||||
|
||||
hud-chat-all = Все
|
||||
hud-chat-chat_tab_hover_tooltip = ПКМ для настроек
|
||||
hud-loot-pickup-msg =
|
||||
{ $actor } подобрал { $amount ->
|
||||
[one] { $item }
|
||||
*[other] { $amount }x { $item }
|
||||
hud-loot-pickup-msg-you = { $amount ->
|
||||
[1] Вы подобрали { $item }
|
||||
*[other] Вы подобрали {$amount}x {$item}
|
||||
}
|
||||
hud-loot-pickup-msg = { $gender ->
|
||||
[she] { $amount ->
|
||||
[1] { $actor } подобрала { $item }
|
||||
*[other] { $actor } подобрала { $amount }x { $item }
|
||||
}
|
||||
*[he] { $amount ->
|
||||
[1] { $actor } подобрал { $item }
|
||||
*[other] { $actor } подобрал { $amount }x { $item }
|
||||
}
|
||||
}
|
||||
hud-chat-goodbye = До свидания!
|
||||
hud-chat-connection_lost = Соединение потеряно. Выход через { $time } секунд.
|
||||
|
@ -163,7 +163,17 @@ hud-chat-chat_tab_hover_tooltip = Правий клік для налаштув
|
||||
|
||||
## HUD Pickup message
|
||||
|
||||
hud-loot-pickup-msg = {$actor} підняли { $amount ->
|
||||
[1] { $item }
|
||||
*[other] {$amount}x {$item}
|
||||
hud-loot-pickup-msg-you = { $amount ->
|
||||
[1] Ви підняли { $item }
|
||||
*[other] Ви підняли {$amount}x {$item}
|
||||
}
|
||||
hud-loot-pickup-msg = { $gender ->
|
||||
[she] { $amount ->
|
||||
[1] { $actor } підняла { $item }
|
||||
*[other] { $actor } підняла { $amount }x { $item }
|
||||
}
|
||||
*[he] { $amount ->
|
||||
[1] { $actor } підняв { $item }
|
||||
*[other] { $actor } підняв { $amount }x { $item }
|
||||
}
|
||||
}
|
@ -96,7 +96,7 @@ const PING_ROLLING_AVERAGE_SECS: usize = 10;
|
||||
#[derive(Debug)]
|
||||
pub enum Event {
|
||||
Chat(comp::ChatMsg),
|
||||
GroupInventoryUpdate(comp::Item, String, Uid),
|
||||
GroupInventoryUpdate(comp::Item, Uid),
|
||||
InviteComplete {
|
||||
target: Uid,
|
||||
answer: InviteAnswer,
|
||||
@ -2657,8 +2657,8 @@ impl Client {
|
||||
kind,
|
||||
});
|
||||
},
|
||||
ServerGeneral::GroupInventoryUpdate(item, taker, uid) => {
|
||||
frontend_events.push(Event::GroupInventoryUpdate(item, taker, uid));
|
||||
ServerGeneral::GroupInventoryUpdate(item, uid) => {
|
||||
frontend_events.push(Event::GroupInventoryUpdate(item, uid));
|
||||
},
|
||||
// Cleanup for when the client goes back to the `presence = None`
|
||||
ServerGeneral::ExitInGameSuccess => {
|
||||
|
@ -162,7 +162,7 @@ pub enum ServerGeneral {
|
||||
/// currently pending
|
||||
InvitePending(Uid),
|
||||
/// Update the HUD of the clients in the group
|
||||
GroupInventoryUpdate(comp::Item, String, Uid),
|
||||
GroupInventoryUpdate(comp::Item, Uid),
|
||||
/// Note: this could potentially include all the failure cases such as
|
||||
/// inviting yourself in which case the `InvitePending` message could be
|
||||
/// removed and the client could consider their invite pending until
|
||||
@ -330,7 +330,7 @@ impl ServerMsg {
|
||||
| ServerGeneral::InviteComplete { .. }
|
||||
| ServerGeneral::ExitInGameSuccess
|
||||
| ServerGeneral::InventoryUpdate(_, _)
|
||||
| ServerGeneral::GroupInventoryUpdate(_, _, _)
|
||||
| ServerGeneral::GroupInventoryUpdate(_, _)
|
||||
| ServerGeneral::TerrainChunkUpdate { .. }
|
||||
| ServerGeneral::TerrainBlockUpdates(_)
|
||||
| ServerGeneral::SetViewDistance(_)
|
||||
|
@ -183,7 +183,7 @@ impl Client {
|
||||
| ServerGeneral::InviteComplete { .. }
|
||||
| ServerGeneral::ExitInGameSuccess
|
||||
| ServerGeneral::InventoryUpdate(_, _)
|
||||
| ServerGeneral::GroupInventoryUpdate(_, _, _)
|
||||
| ServerGeneral::GroupInventoryUpdate(_, _)
|
||||
| ServerGeneral::SetViewDistance(_)
|
||||
| ServerGeneral::Outcomes(_)
|
||||
| ServerGeneral::Knockback(_)
|
||||
|
@ -269,7 +269,6 @@ impl ServerEvent for InventoryManipEvent {
|
||||
&data.uids,
|
||||
&data.groups,
|
||||
&data.alignments,
|
||||
&data.stats,
|
||||
&data.entities,
|
||||
&data.ability_map,
|
||||
&data.msm,
|
||||
@ -322,7 +321,6 @@ impl ServerEvent for InventoryManipEvent {
|
||||
&data.uids,
|
||||
&data.groups,
|
||||
&data.alignments,
|
||||
&data.stats,
|
||||
&data.entities,
|
||||
&data.ability_map,
|
||||
&data.msm,
|
||||
@ -1081,7 +1079,6 @@ fn announce_loot_to_group(
|
||||
uids: &ReadStorage<Uid>,
|
||||
groups: &ReadStorage<comp::Group>,
|
||||
alignments: &ReadStorage<comp::Alignment>,
|
||||
stats: &ReadStorage<comp::Stats>,
|
||||
entities: &Entities,
|
||||
ability_map: &AbilityMap,
|
||||
msm: &MaterialStatManifest,
|
||||
@ -1090,14 +1087,11 @@ fn announce_loot_to_group(
|
||||
members(*group_id, groups, entities, alignments, uids)
|
||||
.filter(|(member_e, _)| member_e != &entity)
|
||||
.for_each(|(e, _)| {
|
||||
clients.get(e).and_then(|c| {
|
||||
stats.get(entity).map(|stats| {
|
||||
c.send_fallible(ServerGeneral::GroupInventoryUpdate(
|
||||
item.duplicate(ability_map, msm),
|
||||
stats.name.to_string(),
|
||||
*uid,
|
||||
))
|
||||
})
|
||||
clients.get(e).map(|c| {
|
||||
c.send_fallible(ServerGeneral::GroupInventoryUpdate(
|
||||
item.duplicate(ability_map, msm),
|
||||
*uid,
|
||||
));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -6,7 +6,11 @@ use super::{
|
||||
};
|
||||
use crate::ui::{fonts::Fonts, ImageFrame, ItemTooltip, ItemTooltipManager, ItemTooltipable};
|
||||
use client::Client;
|
||||
use common::comp::inventory::item::{Item, ItemDesc, ItemI18n, MaterialStatManifest, Quality};
|
||||
use common::{
|
||||
comp::inventory::item::{Item, ItemDesc, ItemI18n, MaterialStatManifest, Quality},
|
||||
uid::Uid,
|
||||
};
|
||||
use common_net::sync::WorldSyncExt;
|
||||
use conrod_core::{
|
||||
color,
|
||||
position::Dimension,
|
||||
@ -105,7 +109,7 @@ impl<'a> LootScroller<'a> {
|
||||
pub struct LootMessage {
|
||||
pub item: Item,
|
||||
pub amount: u32,
|
||||
pub taken_by: String,
|
||||
pub taken_by: Uid,
|
||||
}
|
||||
|
||||
pub struct State {
|
||||
@ -293,6 +297,8 @@ impl<'a> Widget for LootScroller<'a> {
|
||||
.set(state.ids.scrollbar, ui);
|
||||
}
|
||||
|
||||
let stats = self.client.state().read_storage::<common::comp::Stats>();
|
||||
|
||||
while let Some(list_message) = list_messages.next(ui) {
|
||||
let i = list_message.i;
|
||||
|
||||
@ -322,7 +328,7 @@ impl<'a> Widget for LootScroller<'a> {
|
||||
Quality::Artifact => self.imgs.inv_slot_orange,
|
||||
_ => self.imgs.inv_slot_red,
|
||||
};
|
||||
let quality_col = get_quality_col(item);
|
||||
let quality_col = get_quality_col(&item);
|
||||
|
||||
Image::new(self.imgs.pixel)
|
||||
.color(Some(shade_color(quality_col.alpha(0.7))))
|
||||
@ -350,18 +356,67 @@ impl<'a> Widget for LootScroller<'a> {
|
||||
&item_tooltip,
|
||||
)
|
||||
.set(state.ids.message_icons[i], ui);
|
||||
let label = self.localized_strings.get_msg_ctx(
|
||||
"hud-loot-pickup-msg",
|
||||
&i18n::fluent_args! {
|
||||
"actor" => taken_by,
|
||||
"amount" => amount,
|
||||
"item" => {
|
||||
let (name, _) =
|
||||
util::item_text(&item, self.localized_strings, self.item_i18n);
|
||||
name
|
||||
},
|
||||
|
||||
let target_name = self
|
||||
.client
|
||||
.player_list()
|
||||
.get(taken_by)
|
||||
.map_or_else(
|
||||
|| {
|
||||
self.client
|
||||
.state()
|
||||
.ecs()
|
||||
.entity_from_uid(*taken_by)
|
||||
.and_then(|entity| stats.get(entity).map(|e| e.name.clone()))
|
||||
},
|
||||
|info| Some(info.player_alias.clone()),
|
||||
)
|
||||
.unwrap_or_else(|| format!("<uid {}>", *taken_by));
|
||||
|
||||
let (user_gender, is_you) = match self.client.player_list().get(taken_by) {
|
||||
Some(player_info) => match player_info.character.as_ref() {
|
||||
Some(character_info) => (
|
||||
match character_info.gender {
|
||||
Some(common::comp::Gender::Feminine) => "she".to_string(),
|
||||
Some(common::comp::Gender::Masculine) => "he".to_string(),
|
||||
None => "??".to_string(),
|
||||
},
|
||||
self.client.uid().expect("Client doesn't have a Uid!!!") == *taken_by,
|
||||
),
|
||||
None => ("??".to_string(), false),
|
||||
},
|
||||
);
|
||||
None => ("??".to_string(), false),
|
||||
};
|
||||
|
||||
let label = if is_you {
|
||||
self.localized_strings.get_msg_ctx(
|
||||
"hud-loot-pickup-msg-you",
|
||||
&i18n::fluent_args! {
|
||||
"gender" => user_gender,
|
||||
"amount" => amount,
|
||||
"item" => {
|
||||
let (name, _) =
|
||||
util::item_text(&item, self.localized_strings, self.item_i18n);
|
||||
name
|
||||
},
|
||||
},
|
||||
)
|
||||
} else {
|
||||
self.localized_strings.get_msg_ctx(
|
||||
"hud-loot-pickup-msg",
|
||||
&i18n::fluent_args! {
|
||||
"gender" => user_gender,
|
||||
"actor" => target_name,
|
||||
"amount" => amount,
|
||||
"item" => {
|
||||
let (name, _) =
|
||||
util::item_text(&item, self.localized_strings, self.item_i18n);
|
||||
name
|
||||
},
|
||||
},
|
||||
)
|
||||
};
|
||||
|
||||
let label_font_size = 20;
|
||||
|
||||
Text::new(&label)
|
||||
|
@ -289,11 +289,11 @@ impl SessionState {
|
||||
client::Event::Chat(m) => {
|
||||
self.hud.new_message(m);
|
||||
},
|
||||
client::Event::GroupInventoryUpdate(item, taker, uid) => {
|
||||
client::Event::GroupInventoryUpdate(item, uid) => {
|
||||
self.hud.new_loot_message(LootMessage {
|
||||
amount: item.amount(),
|
||||
item,
|
||||
taken_by: client.personalize_alias(uid, taker),
|
||||
taken_by: uid,
|
||||
});
|
||||
},
|
||||
client::Event::InviteComplete {
|
||||
@ -391,7 +391,7 @@ impl SessionState {
|
||||
self.hud.new_loot_message(LootMessage {
|
||||
amount: item.amount(),
|
||||
item,
|
||||
taken_by: "You".to_string(),
|
||||
taken_by: client.uid().expect("Client doesn't have a Uid!!!"),
|
||||
});
|
||||
},
|
||||
_ => {},
|
||||
|
Loading…
Reference in New Issue
Block a user