1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

Tweaks to lobby login window to make it more clear to use

This commit is contained in:
Ivan Savenko 2024-03-29 17:05:41 +02:00
parent 8f0236f046
commit 975cf7de95
4 changed files with 20 additions and 5 deletions

View File

@ -79,6 +79,7 @@
"vcmi.lobby.login.error" : "Connection error: %s", "vcmi.lobby.login.error" : "Connection error: %s",
"vcmi.lobby.login.create" : "New Account", "vcmi.lobby.login.create" : "New Account",
"vcmi.lobby.login.login" : "Login", "vcmi.lobby.login.login" : "Login",
"vcmi.lobby.login.as" : "Login as %s",
"vcmi.lobby.header.rooms" : "Game Rooms - %d", "vcmi.lobby.header.rooms" : "Game Rooms - %d",
"vcmi.lobby.header.channels" : "Chat Channels", "vcmi.lobby.header.channels" : "Chat Channels",
"vcmi.lobby.header.chat.global" : "Global Game Chat - %s", // %s -> language name "vcmi.lobby.header.chat.global" : "Global Game Chat - %s", // %s -> language name

View File

@ -78,6 +78,7 @@
"vcmi.lobby.login.error" : "Помилка з'єднання: %s", "vcmi.lobby.login.error" : "Помилка з'єднання: %s",
"vcmi.lobby.login.create" : "Створити акаунт", "vcmi.lobby.login.create" : "Створити акаунт",
"vcmi.lobby.login.login" : "Увійти", "vcmi.lobby.login.login" : "Увійти",
"vcmi.lobby.login.as" : "Увійти як %s",
"vcmi.lobby.header.rooms" : "Активні кімнати - %d", "vcmi.lobby.header.rooms" : "Активні кімнати - %d",
"vcmi.lobby.header.channels" : "Канали чату", "vcmi.lobby.header.channels" : "Канали чату",
"vcmi.lobby.header.chat.global" : "Глобальний ігровий чат - %s", // %s -> language name "vcmi.lobby.header.chat.global" : "Глобальний ігровий чат - %s", // %s -> language name

View File

@ -36,9 +36,14 @@ GlobalLobbyLoginWindow::GlobalLobbyLoginWindow()
pos.w = 284; pos.w = 284;
pos.h = 220; pos.h = 220;
MetaString loginAs;
loginAs.appendTextID("vcmi.lobby.login.as");
loginAs.replaceTextID(CSH->getGlobalLobby().getAccountDisplayName());
filledBackground = std::make_shared<FilledTexturePlayerColored>(ImagePath::builtin("DiBoxBck"), Rect(0, 0, pos.w, pos.h)); filledBackground = std::make_shared<FilledTexturePlayerColored>(ImagePath::builtin("DiBoxBck"), Rect(0, 0, pos.w, pos.h));
labelTitle = std::make_shared<CLabel>( pos.w / 2, 20, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->translate("vcmi.lobby.login.title")); labelTitle = std::make_shared<CLabel>( pos.w / 2, 20, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->translate("vcmi.lobby.login.title"));
labelUsername = std::make_shared<CLabel>( 10, 65, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->translate("vcmi.lobby.login.username")); labelUsernameTitle = std::make_shared<CLabel>( 10, 65, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->translate("vcmi.lobby.login.username"));
labelUsername = std::make_shared<CLabel>( 10, 65, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, loginAs.toString());
backgroundUsername = std::make_shared<TransparentFilledRectangle>(Rect(10, 90, 264, 20), ColorRGBA(0,0,0,128), ColorRGBA(64,64,64,64)); backgroundUsername = std::make_shared<TransparentFilledRectangle>(Rect(10, 90, 264, 20), ColorRGBA(0,0,0,128), ColorRGBA(64,64,64,64));
inputUsername = std::make_shared<CTextInput>(Rect(15, 93, 260, 16), FONT_SMALL, nullptr, ETextAlignment::TOPLEFT, true); inputUsername = std::make_shared<CTextInput>(Rect(15, 93, 260, 16), FONT_SMALL, nullptr, ETextAlignment::TOPLEFT, true);
buttonLogin = std::make_shared<CButton>(Point(10, 180), AnimationPath::builtin("MuBchck"), CButton::tooltip(), [this](){ onLogin(); }); buttonLogin = std::make_shared<CButton>(Point(10, 180), AnimationPath::builtin("MuBchck"), CButton::tooltip(), [this](){ onLogin(); });
@ -56,7 +61,7 @@ GlobalLobbyLoginWindow::GlobalLobbyLoginWindow()
toggleMode->setSelected(settings["lobby"]["roomType"].Integer()); toggleMode->setSelected(settings["lobby"]["roomType"].Integer());
toggleMode->addCallback([this](int index){onLoginModeChanged(index);}); toggleMode->addCallback([this](int index){onLoginModeChanged(index);});
if (settings["lobby"]["accountID"].String().empty()) if (CSH->getGlobalLobby().getAccountID().empty())
{ {
buttonLogin->block(true); buttonLogin->block(true);
toggleMode->setSelected(0); toggleMode->setSelected(0);
@ -77,12 +82,19 @@ void GlobalLobbyLoginWindow::onLoginModeChanged(int value)
{ {
if (value == 0) if (value == 0)
{ {
inputUsername->setText(""); inputUsername->enable();
backgroundUsername->enable();
labelUsernameTitle->enable();
labelUsername->disable();
} }
else else
{ {
inputUsername->setText(settings["lobby"]["displayName"].String()); inputUsername->disable();
backgroundUsername->disable();
labelUsernameTitle->disable();
labelUsername->enable();
} }
redraw();
} }
void GlobalLobbyLoginWindow::onClose() void GlobalLobbyLoginWindow::onClose()
@ -104,7 +116,7 @@ void GlobalLobbyLoginWindow::onLogin()
void GlobalLobbyLoginWindow::onConnectionSuccess() void GlobalLobbyLoginWindow::onConnectionSuccess()
{ {
std::string accountID = settings["lobby"]["accountID"].String(); std::string accountID = CSH->getGlobalLobby().getAccountID();
if(toggleMode->getSelected() == 0) if(toggleMode->getSelected() == 0)
CSH->getGlobalLobby().sendClientRegister(inputUsername->getText()); CSH->getGlobalLobby().sendClientRegister(inputUsername->getText());

View File

@ -23,6 +23,7 @@ class GlobalLobbyLoginWindow : public CWindowObject
{ {
std::shared_ptr<FilledTexturePlayerColored> filledBackground; std::shared_ptr<FilledTexturePlayerColored> filledBackground;
std::shared_ptr<CLabel> labelTitle; std::shared_ptr<CLabel> labelTitle;
std::shared_ptr<CLabel> labelUsernameTitle;
std::shared_ptr<CLabel> labelUsername; std::shared_ptr<CLabel> labelUsername;
std::shared_ptr<CTextBox> labelStatus; std::shared_ptr<CTextBox> labelStatus;
std::shared_ptr<TransparentFilledRectangle> backgroundUsername; std::shared_ptr<TransparentFilledRectangle> backgroundUsername;