Show player location if available from server
This commit is contained in:
parent
1b5c0fbabe
commit
480ce07ae0
@ -2,22 +2,21 @@
|
||||
<stkgui>
|
||||
<div x="2%" y="5%" width="96%" height="85%" layout="vertical-row" >
|
||||
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
|
||||
I18N="User info dialog' dialog" text="User Info"/>
|
||||
I18N="User info dialog" text="User Info"/>
|
||||
|
||||
<spacer height="20" width="50"/>
|
||||
<spacer height="15" width="50"/>
|
||||
|
||||
<div width="80%" align="center" layout="vertical-row" height="fit" >
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" text_align="left" I18N="User info dialog" text="Name"/>
|
||||
<label id="name" proportion="2" text_align="left" text=""/>
|
||||
<div width="100%" height="fit" layout="horizontal-row">
|
||||
<label id="desc" proportion="2" text_align="left" word_wrap="true" text=""/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="20" width="50"/>
|
||||
<spacer height="15" width="50"/>
|
||||
|
||||
<label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true" text=""/>
|
||||
|
||||
<spacer height="20" width="50"/>
|
||||
<spacer height="15" width="50"/>
|
||||
|
||||
<buttonbar id="options" width="90%" height="20%" align="center">
|
||||
<icon-button id="remove" width="64" height="64" icon="gui/icons/package-uninstall.png"
|
||||
|
@ -42,9 +42,20 @@ using namespace Online;
|
||||
// ----------------------------------------------------------------------------
|
||||
void NetworkUserDialog::beforeAddingWidgets()
|
||||
{
|
||||
m_name_widget = getWidget<LabelWidget>("name");
|
||||
assert(m_name_widget != NULL);
|
||||
m_name_widget->setText(m_name, false);
|
||||
m_desc_widget = getWidget<LabelWidget>("desc");
|
||||
assert(m_desc_widget != NULL);
|
||||
//I18N: In the network user dialog
|
||||
core::stringw desc = _("Player name: %s", m_name);
|
||||
if (!m_country_code.empty())
|
||||
{
|
||||
core::stringw country_name =
|
||||
translations->getLocalizedCountryName(m_country_code);
|
||||
desc += L"\n";
|
||||
//I18N: In the network user dialog, show the player location with
|
||||
//country name (based on IP geolocation)
|
||||
desc += _("Player location: %s", country_name);
|
||||
}
|
||||
m_desc_widget->setText(desc, false);
|
||||
|
||||
m_info_widget = getWidget<LabelWidget>("info");
|
||||
assert(m_info_widget != NULL);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "states_screens/dialogs/ranking_callback.hpp"
|
||||
#include "utils/types.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <irrString.h>
|
||||
#include <memory>
|
||||
|
||||
@ -51,6 +52,8 @@ private:
|
||||
|
||||
const core::stringw m_name;
|
||||
|
||||
const std::string m_country_code;
|
||||
|
||||
const bool m_allow_change_team;
|
||||
|
||||
bool m_self_destroy, m_open_report_textbox;
|
||||
@ -59,7 +62,7 @@ private:
|
||||
|
||||
GUIEngine::RibbonWidget* m_options_widget;
|
||||
|
||||
GUIEngine::LabelWidget* m_name_widget;
|
||||
GUIEngine::LabelWidget* m_desc_widget;
|
||||
|
||||
GUIEngine::LabelWidget* m_info_widget;
|
||||
|
||||
@ -76,10 +79,12 @@ private:
|
||||
GUIEngine::IconButtonWidget* m_report_widget;
|
||||
public:
|
||||
NetworkUserDialog(uint32_t host_id, uint32_t online_id, uint8_t local_id,
|
||||
const core::stringw& name, bool allow_change_team,
|
||||
const core::stringw& name,
|
||||
const std::string& country_code, bool allow_change_team,
|
||||
PerPlayerDifficulty d)
|
||||
: ModalDialog(0.8f,0.8f), m_host_id(host_id), m_online_id(online_id),
|
||||
m_local_id(local_id), m_per_player_difficulty(d), m_name(name),
|
||||
m_local_id(local_id), m_per_player_difficulty(d),
|
||||
m_name(name), m_country_code(country_code),
|
||||
m_allow_change_team(allow_change_team), m_self_destroy(false),
|
||||
m_open_report_textbox(false),
|
||||
m_fetched_ranking(std::make_shared<bool>(false))
|
||||
|
@ -50,7 +50,9 @@ void UserInfoDialog::load()
|
||||
loadFromFile("online/user_info_dialog.stkgui");
|
||||
if(m_error)
|
||||
m_info_widget->setErrorColor();
|
||||
m_name_widget->setText(m_online_profile->getUserName(),false);
|
||||
//I18N: In the user info dialog
|
||||
m_desc_widget->setText(_("Username: %s", m_online_profile->getUserName()),
|
||||
false);
|
||||
m_info_widget->setText(m_info, false);
|
||||
if(m_remove_widget->isVisible() && !m_online_profile->isFriend())
|
||||
m_remove_widget->setLabel(_("Cancel Request"));
|
||||
@ -68,8 +70,8 @@ void UserInfoDialog::beforeAddingWidgets()
|
||||
m_self_destroy = false;
|
||||
m_enter_profile = false;
|
||||
m_processing = false;
|
||||
m_name_widget = getWidget<LabelWidget>("name");
|
||||
assert(m_name_widget != NULL);
|
||||
m_desc_widget = getWidget<LabelWidget>("desc");
|
||||
assert(m_desc_widget != NULL);
|
||||
m_info_widget = getWidget<LabelWidget>("info");
|
||||
assert(m_info_widget != NULL);
|
||||
|
||||
|
@ -49,7 +49,7 @@ private:
|
||||
const uint32_t m_showing_id;
|
||||
Online::OnlineProfile * m_online_profile;
|
||||
|
||||
GUIEngine::LabelWidget * m_name_widget;
|
||||
GUIEngine::LabelWidget * m_desc_widget;
|
||||
GUIEngine::LabelWidget * m_info_widget;
|
||||
|
||||
GUIEngine::RibbonWidget * m_options_widget;
|
||||
|
@ -559,6 +559,8 @@ void NetworkingLobby::eventCallback(Widget* widget, const std::string& name,
|
||||
host_online_local_ids[1], host_online_local_ids[2],
|
||||
m_player_names.at(
|
||||
m_player_list->getSelectionInternalName()).m_user_name,
|
||||
m_player_names.at(
|
||||
m_player_list->getSelectionInternalName()).m_country_code,
|
||||
m_allow_change_team,
|
||||
m_player_names.at(
|
||||
m_player_list->getSelectionInternalName()).m_difficulty);
|
||||
|
Loading…
Reference in New Issue
Block a user