Improve in-race chat
* Limit in-race chat to 3 lines instead of 5 * Add an option to disable in-race chat (while keeping lobby chat)
This commit is contained in:
parent
9647dea346
commit
658345c9ff
@ -63,7 +63,15 @@
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<checkbox id="enable-lobby-chat"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
<label height="100%" id="label-lobby-chat" I18N="In the general settings" text="Enable chatting in online games" word_wrap="true"/>
|
||||
<label height="100%" id="label-lobby-chat" I18N="In the general settings" text="Enable chatting online" word_wrap="true"/>
|
||||
</div>
|
||||
|
||||
<spacer width="5" height="4%"/>
|
||||
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<checkbox id="enable-race-chat"/>
|
||||
<spacer width="1%" height="100%" />
|
||||
<label height="100%" id="label-race-chat" I18N="In the general settings" text="Enable chatting in online games" word_wrap="true"/>
|
||||
</div>
|
||||
|
||||
<spacer width="5" height="4%"/>
|
||||
|
@ -792,6 +792,9 @@ namespace UserConfigParams
|
||||
PARAM_DEFAULT(BoolUserConfigParam(true, "lobby-chat",
|
||||
&m_network_group, "Enable chatting in networking lobby, if off than "
|
||||
"no chat message will be displayed from any players."));
|
||||
PARAM_PREFIX BoolUserConfigParam m_race_chat
|
||||
PARAM_DEFAULT(BoolUserConfigParam(true, "race-chat",
|
||||
&m_network_group, "Enable chatting during races."));
|
||||
PARAM_PREFIX IntUserConfigParam m_max_players
|
||||
PARAM_DEFAULT(IntUserConfigParam(8, "max-players",
|
||||
&m_network_group, "Maximum number of players on the server "
|
||||
|
@ -132,9 +132,9 @@ public:
|
||||
const unsigned height = irr_driver->getActualScreenSize().Height;
|
||||
gui::IGUIFont* font = GUIEngine::getFont();
|
||||
font->initGlyphLayouts(m_message, m_gls);
|
||||
// Reserve space for 5 lines of text, it will occupy the circle
|
||||
// Reserve space for 3 lines of text, it will occupy the circle
|
||||
const int max_width = width - (brp.m_left_border +
|
||||
brp.m_right_border) - (font->getHeightPerLine() * 5);
|
||||
brp.m_right_border) - (font->getHeightPerLine() * 3);
|
||||
if (max_width < 0)
|
||||
{
|
||||
m_display_timer = -1;
|
||||
@ -147,18 +147,18 @@ public:
|
||||
font->getHeightPerLine(), font->getInverseShaping(),
|
||||
font->getScale());
|
||||
|
||||
if ((int)dim.Height > font->getHeightPerLine() * 5)
|
||||
if ((int)dim.Height > font->getHeightPerLine() * 3)
|
||||
{
|
||||
// Max 5 lines to prevent too long message from network chat
|
||||
// Max 3 lines to prevent too long message from network chat
|
||||
int newline_count = 0;
|
||||
for (unsigned i = 0; i < m_gls.size(); i++)
|
||||
{
|
||||
if (m_gls[i].flags & gui::GLF_NEWLINE)
|
||||
{
|
||||
if (++newline_count >= 5)
|
||||
if (++newline_count >= 3)
|
||||
{
|
||||
m_gls.erase(m_gls.begin() + i, m_gls.end());
|
||||
dim.Height = font->getHeightPerLine() * 5;
|
||||
dim.Height = font->getHeightPerLine() * 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -874,7 +874,7 @@ void ClientLobby::handleChat(Event* event)
|
||||
{
|
||||
if (GUIEngine::getCurrentScreen() == NetworkingLobby::getInstance())
|
||||
NetworkingLobby::getInstance()->addMoreServerInfo(message);
|
||||
else
|
||||
else if (UserConfigParams::m_race_chat)
|
||||
MessageQueue::add(MessageQueue::MT_GENERIC, message);
|
||||
}
|
||||
} // handleChat
|
||||
|
@ -86,7 +86,7 @@ RacePausedDialog::RacePausedDialog(const float percentWidth,
|
||||
getWidget("send")->setText(L"\u21B2");
|
||||
// Unicode smile emoji
|
||||
getWidget("emoji")->setText(L"\u263A");
|
||||
if (UserConfigParams::m_lobby_chat)
|
||||
if (UserConfigParams::m_lobby_chat && UserConfigParams::m_race_chat)
|
||||
{
|
||||
m_text_box->setActive(true);
|
||||
getWidget("send")->setVisible(true);
|
||||
|
@ -88,24 +88,9 @@ void OptionsScreenGeneral::init()
|
||||
assert( internet_enabled != NULL );
|
||||
internet_enabled->setState( UserConfigParams::m_internet_status
|
||||
==RequestManager::IPERM_ALLOWED );
|
||||
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
|
||||
assert( stats != NULL );
|
||||
stats->setState(UserConfigParams::m_hw_report_enable);
|
||||
|
||||
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-lobby-chat");
|
||||
setInternetCheckboxes(internet_enabled->getState());
|
||||
|
||||
if(internet_enabled->getState())
|
||||
{
|
||||
stats->setActive(true);
|
||||
stats->setState(UserConfigParams::m_hw_report_enable);
|
||||
chat->setActive(true);
|
||||
chat->setState(UserConfigParams::m_lobby_chat);
|
||||
}
|
||||
else
|
||||
{
|
||||
stats->setActive(false);
|
||||
chat->setActive(false);
|
||||
}
|
||||
CheckBoxWidget* handicap = getWidget<CheckBoxWidget>("enable-handicap");
|
||||
assert( handicap != NULL );
|
||||
handicap->setState( UserConfigParams::m_per_player_difficulty );
|
||||
@ -187,36 +172,12 @@ void OptionsScreenGeneral::eventCallback(Widget* widget, const std::string& name
|
||||
// If internet gets enabled, re-initialise the addon manager (which
|
||||
// happens in a separate thread) so that news.xml etc can be
|
||||
// downloaded if necessary.
|
||||
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
|
||||
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-lobby-chat");
|
||||
setInternetCheckboxes(internet->getState());
|
||||
PlayerProfile* profile = PlayerManager::getCurrentPlayer();
|
||||
if(internet->getState())
|
||||
{
|
||||
NewsManager::get()->init(false);
|
||||
stats->setActive(true);
|
||||
stats->setState(UserConfigParams::m_hw_report_enable);
|
||||
chat->setActive(true);
|
||||
chat->setState(UserConfigParams::m_lobby_chat);
|
||||
#ifdef MOBILE_STK
|
||||
getWidget("assets_settings")->setActive(true);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
chat->setActive(false);
|
||||
stats->setActive(false);
|
||||
#ifdef MOBILE_STK
|
||||
getWidget("assets_settings")->setActive(false);
|
||||
#endif
|
||||
|
||||
// Disable this, so that the user has to re-check this if
|
||||
// enabled later (for GDPR compliance).
|
||||
UserConfigParams::m_hw_report_enable = false;
|
||||
stats->setState(false);
|
||||
|
||||
PlayerProfile* profile = PlayerManager::getCurrentPlayer();
|
||||
if (profile != NULL && profile->isLoggedIn())
|
||||
profile->requestSignOut();
|
||||
}
|
||||
else if (profile != NULL && profile->isLoggedIn())
|
||||
profile->requestSignOut();
|
||||
|
||||
// Deactivate internet after 'requestSignOut' so that the sign out request is allowed
|
||||
if (!internet->getState())
|
||||
@ -233,6 +194,13 @@ void OptionsScreenGeneral::eventCallback(Widget* widget, const std::string& name
|
||||
{
|
||||
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-lobby-chat");
|
||||
UserConfigParams::m_lobby_chat = chat->getState();
|
||||
CheckBoxWidget* race_chat = getWidget<CheckBoxWidget>("enable-race-chat");
|
||||
race_chat->setActive(UserConfigParams::m_lobby_chat);
|
||||
}
|
||||
else if (name=="enable-race-chat")
|
||||
{
|
||||
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-race-chat");
|
||||
UserConfigParams::m_race_chat = chat->getState();
|
||||
}
|
||||
else if (name=="show-login")
|
||||
{
|
||||
@ -272,6 +240,39 @@ void OptionsScreenGeneral::eventCallback(Widget* widget, const std::string& name
|
||||
#endif
|
||||
} // eventCallback
|
||||
|
||||
void OptionsScreenGeneral::setInternetCheckboxes(bool activate)
|
||||
{
|
||||
CheckBoxWidget* stats = getWidget<CheckBoxWidget>("enable-hw-report");
|
||||
CheckBoxWidget* chat = getWidget<CheckBoxWidget>("enable-lobby-chat");
|
||||
CheckBoxWidget* race_chat = getWidget<CheckBoxWidget>("enable-race-chat");
|
||||
|
||||
if (activate)
|
||||
{
|
||||
stats->setActive(true);
|
||||
stats->setState(UserConfigParams::m_hw_report_enable);
|
||||
chat->setActive(true);
|
||||
chat->setState(UserConfigParams::m_lobby_chat);
|
||||
race_chat->setActive(UserConfigParams::m_lobby_chat);
|
||||
race_chat->setState(UserConfigParams::m_race_chat);
|
||||
#ifdef MOBILE_STK
|
||||
getWidget("assets_settings")->setActive(true);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
chat->setActive(false);
|
||||
stats->setActive(false);
|
||||
race_chat->setActive(false);
|
||||
#ifdef MOBILE_STK
|
||||
getWidget("assets_settings")->setActive(false);
|
||||
#endif
|
||||
// Disable this, so that the user has to re-check this if
|
||||
// enabled later (for GDPR compliance).
|
||||
UserConfigParams::m_hw_report_enable = false;
|
||||
stats->setState(false);
|
||||
}
|
||||
} // setInternetCheckboxes
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OptionsScreenGeneral::tearDown()
|
||||
|
@ -38,6 +38,8 @@ class OptionsScreenGeneral : public GUIEngine::Screen, public GUIEngine::ScreenS
|
||||
|
||||
std::vector<std::string> m_skins;
|
||||
|
||||
void setInternetCheckboxes(bool activate);
|
||||
|
||||
public:
|
||||
friend class GUIEngine::ScreenSingleton<OptionsScreenGeneral>;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user