Fix and improve guiConfirmRegistration dialog
This commit is contained in:
parent
c820cb204a
commit
e8dc878d1f
@ -1779,7 +1779,7 @@ msgid ""
|
||||
"Please retype your password and click 'Register and Join' to confirm account "
|
||||
"creation, or click 'Cancel' to abort."
|
||||
msgstr ""
|
||||
"Te most %1$s szerverre csatlakozol \"%2$s\" névvel először.\n"
|
||||
"Te most szerverre csatlakozol \"%s\" névvel először.\n"
|
||||
"Ha folytatod, akkor egy új fiók lesz létrehozva a hitelesítő adatokkal a "
|
||||
"szerveren.\n"
|
||||
"Kérlek írd be újra a jelszavad, kattints Regisztrációra majd "
|
||||
|
@ -1801,7 +1801,7 @@ msgid ""
|
||||
"Please retype your password and click 'Register and Join' to confirm account "
|
||||
"creation, or click 'Cancel' to abort."
|
||||
msgstr ""
|
||||
"Du er i gang med å hoppe inn i ein tenarmaskin ved %1$s med namnet \"%2$s\" "
|
||||
"Du er i gang med å hoppe inn i ein tenarmaskin ved med namnet \"%s\" "
|
||||
"for fyrste gong. Om du går videre, ein ny brukar med dine detaljer vill bli "
|
||||
"skapt på tenarmaskinen.\n"
|
||||
"Ver vennleg og skriv passordet, klikk registrer og trykk \"bli med\" for at "
|
||||
|
@ -1795,7 +1795,7 @@ msgstr "Hasła nie są jednakowe!"
|
||||
|
||||
#: src/gui/guiConfirmRegistration.cpp
|
||||
msgid "Register and Join"
|
||||
msgstr "Zarejestruj się i dołącz"
|
||||
msgstr "Zarejestruj się i Dołącz"
|
||||
|
||||
#: src/gui/guiConfirmRegistration.cpp
|
||||
#, c-format
|
||||
@ -1806,9 +1806,9 @@ msgid ""
|
||||
"Please retype your password and click 'Register and Join' to confirm account "
|
||||
"creation, or click 'Cancel' to abort."
|
||||
msgstr ""
|
||||
"Próbujesz wejść na serwer \"%s\" o nazwie \"%2$s2\" po raz pierwszy . Jeśli "
|
||||
"zdecydujesz się kontynuować na serwerze zostanie utworzone nowe konto z "
|
||||
"Twoim danymi.\n"
|
||||
"Próbujesz wejść na serwer o nazwie \"%s\" po raz pierwszy. Jeśli "
|
||||
"zdecydujesz się kontynuować, na serwerze zostanie utworzone nowe konto z "
|
||||
"Twoimi danymi.\n"
|
||||
"Wpisz ponownie hasło i wciśnij \"Zarejestruj się i Dołącz\" aby potwierdzić "
|
||||
"utworzenie konta lub wciśnij \"Anuluj\" aby przerwać ten proces."
|
||||
|
||||
|
@ -1821,7 +1821,7 @@ msgid ""
|
||||
"Please retype your password and click 'Register and Join' to confirm account "
|
||||
"creation, or click 'Cancel' to abort."
|
||||
msgstr ""
|
||||
"คุณกำลังจะเข้าร่วมเซิร์ฟเวอร์ที่ %1$s1 ด้วยชื่อ '%2$s2' เป็นครั้งแรก ถ้าคุณดำเนินการ "
|
||||
"คุณกำลังจะเข้าร่วมเซิร์ฟเวอร์ที่ ด้วยชื่อ '%s' เป็นครั้งแรก ถ้าคุณดำเนินการ "
|
||||
"จะมีสร้างบัญชีใหม่โดยใช้ข้อมูลประจำตัวของคุณบนเซิร์ฟเวอร์นี้ \n"
|
||||
"กรุณาพิมพ์รหัสผ่านของคุณ และคลิกที่ลงทะเบียนและเข้าร่วมเพื่อยืนยันการสร้างบัญชีผู้ใช้ "
|
||||
"หรือคลิกยกเลิกเพื่อยกเลิก."
|
||||
|
@ -1583,7 +1583,8 @@ bool Game::connectToServer(const GameStartData &start_data,
|
||||
if (client->m_is_registration_confirmation_state) {
|
||||
if (registration_confirmation_shown) {
|
||||
// Keep drawing the GUI
|
||||
RenderingEngine::draw_menu_scene(guienv, dtime, true);
|
||||
ITextureSource *tsrc = client->getTextureSource();
|
||||
RenderingEngine::draw_menu_scene(guienv, tsrc, dtime);
|
||||
} else {
|
||||
registration_confirmation_shown = true;
|
||||
(new GUIConfirmRegistration(guienv, guienv->getRootGUIElement(), -1,
|
||||
|
@ -514,6 +514,7 @@ void RenderingEngine::_draw_load_screen(const std::wstring &text,
|
||||
get_video_driver()->beginScene(true, true, video::SColor(255, 0, 0, 0));
|
||||
video::ITexture *background_image = tsrc->getTexture("bg.png");
|
||||
|
||||
v2u32 screensize = driver->getScreenSize();
|
||||
get_video_driver()->draw2DImage(background_image,
|
||||
irr::core::rect<s32>(0, 0, screensize.X * 4, screensize.Y * 4),
|
||||
irr::core::rect<s32>(0, 0, screensize.X, screensize.Y), 0, 0, false);
|
||||
@ -589,7 +590,7 @@ void RenderingEngine::_draw_load_screen(const std::wstring &text,
|
||||
Draws the menu scene including (optional) cloud background.
|
||||
*/
|
||||
void RenderingEngine::_draw_menu_scene(gui::IGUIEnvironment *guienv,
|
||||
float dtime, bool clouds)
|
||||
ITextureSource *tsrc, float dtime, bool clouds)
|
||||
{
|
||||
bool cloud_menu_background = clouds && g_settings->getBool("menu_clouds");
|
||||
if (cloud_menu_background) {
|
||||
@ -598,8 +599,15 @@ void RenderingEngine::_draw_menu_scene(gui::IGUIEnvironment *guienv,
|
||||
get_video_driver()->beginScene(
|
||||
true, true, video::SColor(255, 140, 186, 250));
|
||||
g_menucloudsmgr->drawAll();
|
||||
} else
|
||||
} else {
|
||||
get_video_driver()->beginScene(true, true, video::SColor(255, 0, 0, 0));
|
||||
video::ITexture *background_image = tsrc->getTexture("bg.png");
|
||||
|
||||
v2u32 screensize = driver->getScreenSize();
|
||||
get_video_driver()->draw2DImage(background_image,
|
||||
irr::core::rect<s32>(0, 0, screensize.X * 4, screensize.Y * 4),
|
||||
irr::core::rect<s32>(0, 0, screensize.X, screensize.Y), 0, 0, false);
|
||||
}
|
||||
|
||||
guienv->drawAll();
|
||||
get_video_driver()->endScene();
|
||||
|
@ -112,9 +112,10 @@ public:
|
||||
}
|
||||
|
||||
inline static void draw_menu_scene(
|
||||
gui::IGUIEnvironment *guienv, float dtime, bool clouds)
|
||||
gui::IGUIEnvironment *guienv, ITextureSource *tsrc,
|
||||
float dtime, bool clouds = false)
|
||||
{
|
||||
s_singleton->_draw_menu_scene(guienv, dtime, clouds);
|
||||
s_singleton->_draw_menu_scene(guienv, tsrc, dtime, clouds);
|
||||
}
|
||||
|
||||
inline static void draw_scene(video::SColor skycolor, bool show_hud,
|
||||
@ -145,8 +146,9 @@ private:
|
||||
ITextureSource *tsrc, float dtime = 0, int percent = 0,
|
||||
bool clouds = false);
|
||||
|
||||
void _draw_menu_scene(gui::IGUIEnvironment *guienv, float dtime = 0,
|
||||
bool clouds = true);
|
||||
void _draw_menu_scene(gui::IGUIEnvironment *guienv,
|
||||
ITextureSource *tsrc, float dtime = 0,
|
||||
bool clouds = false);
|
||||
|
||||
void _draw_scene(video::SColor skycolor, bool show_hud, bool show_minimap,
|
||||
bool draw_wield_tool, bool draw_crosshair);
|
||||
|
@ -71,15 +71,15 @@ public:
|
||||
STATE_INVALID = 1 << 3,
|
||||
};
|
||||
|
||||
// Used in guiKeyChangeMenu.cpp and guiVolumeChange.h
|
||||
// Is this the best place to put this function?
|
||||
static std::array<StyleSpec, NUM_STATES> getButtonStyle(const std::string texture_path = "") {
|
||||
// Used in guiConfirmRegistration.cpp, guiKeyChangeMenu.cpp and guiVolumeChange.h
|
||||
static std::array<StyleSpec, NUM_STATES> getButtonStyle(const std::string texture_path = "", std::string color = "") {
|
||||
std::array<StyleSpec, NUM_STATES> ret;
|
||||
color = color != "" ? "_" + color : "";
|
||||
|
||||
const bool high_dpi = RenderingEngine::isHighDpi();
|
||||
const std::string x2 = high_dpi ? ".x2" : "";
|
||||
StyleSpec btn_spec;
|
||||
btn_spec.set(BGIMG, texture_path + "gui/gui_button" + x2 + ".png");
|
||||
btn_spec.set(BGIMG, texture_path + "gui/gui_button" + color + x2 + ".png");
|
||||
btn_spec.set(BGIMG_MIDDLE, high_dpi ? "48" : "32");
|
||||
btn_spec.set(BORDER, "false");
|
||||
btn_spec.set(PADDING, high_dpi ? "-30" : "-20");
|
||||
@ -87,11 +87,11 @@ public:
|
||||
ret[STATE_DEFAULT] = btn_spec;
|
||||
|
||||
StyleSpec hovered_spec;
|
||||
hovered_spec.set(BGIMG, texture_path + "gui/gui_button_hovered" + x2 + ".png");
|
||||
hovered_spec.set(BGIMG, texture_path + "gui/gui_button" + color + "_hovered" + x2 + ".png");
|
||||
ret[STATE_HOVERED] = hovered_spec;
|
||||
|
||||
StyleSpec pressed_spec;
|
||||
pressed_spec.set(BGIMG, texture_path + "gui/gui_button_pressed" + x2 + ".png");
|
||||
pressed_spec.set(BGIMG, texture_path + "gui/gui_button" + color + "_pressed" + x2 + ".png");
|
||||
ret[STATE_PRESSED] = pressed_spec;
|
||||
|
||||
return ret;
|
||||
|
@ -20,18 +20,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
#include "guiConfirmRegistration.h"
|
||||
#include "client/client.h"
|
||||
#include "filesys.h"
|
||||
#include "guiBackgroundImage.h"
|
||||
#include "guiButton.h"
|
||||
#include "guiEditBoxWithScrollbar.h"
|
||||
#include <IGUICheckBox.h>
|
||||
#include <IGUIButton.h>
|
||||
#include <IGUIStaticText.h>
|
||||
#include <IGUIFont.h>
|
||||
#include "intlGUIEditBox.h"
|
||||
#include "porting.h"
|
||||
|
||||
#if USE_FREETYPE && IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9
|
||||
#include "intlGUIEditBox.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
#include "client/renderingengine.h"
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#include "gettext.h"
|
||||
|
||||
// Continuing from guiPasswordChange.cpp
|
||||
@ -40,6 +50,8 @@ const int ID_confirm = 263;
|
||||
const int ID_intotext = 264;
|
||||
const int ID_cancel = 265;
|
||||
const int ID_message = 266;
|
||||
const int ID_background = 267;
|
||||
const int ID_confirmPasswordBg = 268;
|
||||
|
||||
GUIConfirmRegistration::GUIConfirmRegistration(gui::IGUIEnvironment *env,
|
||||
gui::IGUIElement *parent, s32 id, IMenuManager *menumgr, Client *client,
|
||||
@ -52,11 +64,29 @@ GUIConfirmRegistration::GUIConfirmRegistration(gui::IGUIEnvironment *env,
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
m_touchscreen_visible = false;
|
||||
#endif
|
||||
|
||||
v3f formspec_bgcolor = g_settings->getV3F("formspec_fullscreen_bg_color");
|
||||
m_fullscreen_bgcolor = video::SColor(
|
||||
(u8) MYMIN(MYMAX(g_settings->getS32("formspec_fullscreen_bg_opacity"), 0), 255),
|
||||
MYMIN(MYMAX(myround(formspec_bgcolor.X), 0), 255),
|
||||
MYMIN(MYMAX(myround(formspec_bgcolor.Y), 0), 255),
|
||||
MYMIN(MYMAX(myround(formspec_bgcolor.Z), 0), 255)
|
||||
);
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
if (porting::hasRealKeyboard())
|
||||
SDL_StartTextInput();
|
||||
#endif
|
||||
}
|
||||
|
||||
GUIConfirmRegistration::~GUIConfirmRegistration()
|
||||
{
|
||||
removeChildren();
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
if (porting::hasRealKeyboard() && SDL_IsTextInputActive())
|
||||
SDL_StopTextInput();
|
||||
#endif
|
||||
}
|
||||
|
||||
void GUIConfirmRegistration::removeChildren()
|
||||
@ -77,11 +107,13 @@ void GUIConfirmRegistration::regenerateGui(v2u32 screensize)
|
||||
/*
|
||||
Calculate new sizes and positions
|
||||
*/
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
const float s = m_gui_scale * RenderingEngine::getDisplayDensity() / 2;
|
||||
float s = MYMIN(screensize.X / 600.f, screensize.Y / 360.f);
|
||||
#if HAVE_TOUCHSCREENGUI
|
||||
s *= g_settings->getBool("device_is_tablet") ? 0.7f : 0.8f;
|
||||
#else
|
||||
const float s = m_gui_scale;
|
||||
s *= 0.5f;
|
||||
#endif
|
||||
|
||||
DesiredRect = core::rect<s32>(
|
||||
screensize.X / 2 - 600 * s / 2,
|
||||
screensize.Y / 2 - 360 * s / 2,
|
||||
@ -98,11 +130,21 @@ void GUIConfirmRegistration::regenerateGui(v2u32 screensize)
|
||||
/*
|
||||
Add stuff
|
||||
*/
|
||||
s32 ypos = 30 * s;
|
||||
|
||||
// Background image
|
||||
{
|
||||
const std::string texture = "bg_common.png";
|
||||
const core::rect<s32> rect(0, 0, 0, 0);
|
||||
const core::rect<s32> middle(40, 40, -40, -40);
|
||||
new GUIBackgroundImage(Environment, this, ID_background, rect,
|
||||
texture, middle, m_tsrc, true);
|
||||
}
|
||||
|
||||
s32 ypos = 20 * s;
|
||||
{
|
||||
core::rect<s32> rect2(0, 0, 540 * s, 180 * s);
|
||||
rect2 += topleft_client + v2s32(30 * s, ypos);
|
||||
static const std::string info_text_template = strgettext(
|
||||
const std::string info_text_template = strgettext(
|
||||
"You are about to join this server with the name \"%s\" for the "
|
||||
"first time.\n"
|
||||
"If you proceed, a new account using your credentials will be "
|
||||
@ -114,8 +156,13 @@ void GUIConfirmRegistration::regenerateGui(v2u32 screensize)
|
||||
info_text_template.c_str(), m_playername.c_str());
|
||||
|
||||
wchar_t *info_text_buf_wide = utf8_to_wide_c(info_text_buf);
|
||||
#if USE_FREETYPE && IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9
|
||||
gui::IGUIEditBox *e = new gui::intlGUIEditBox(info_text_buf_wide, true,
|
||||
Environment, this, ID_intotext, rect2, false, true);
|
||||
#else
|
||||
gui::IGUIEditBox *e = new GUIEditBoxWithScrollBar(info_text_buf_wide, true,
|
||||
Environment, this, ID_intotext, rect2, false, true);
|
||||
#endif
|
||||
delete[] info_text_buf_wide;
|
||||
e->drop();
|
||||
e->setMultiLine(true);
|
||||
@ -123,40 +170,54 @@ void GUIConfirmRegistration::regenerateGui(v2u32 screensize)
|
||||
e->setTextAlignment(gui::EGUIA_UPPERLEFT, gui::EGUIA_CENTER);
|
||||
}
|
||||
|
||||
ypos += 200 * s;
|
||||
{
|
||||
core::rect<s32> rect2(0, 0, 540 * s, 30 * s);
|
||||
rect2 += topleft_client + v2s32(30 * s, ypos);
|
||||
gui::IGUIEditBox *e = Environment->addEditBox(m_pass_confirm.c_str(),
|
||||
rect2, true, this, ID_confirmPassword);
|
||||
e->setPasswordBox(true);
|
||||
Environment->setFocus(e);
|
||||
}
|
||||
|
||||
ypos += 50 * s;
|
||||
{
|
||||
core::rect<s32> rect2(0, 0, 230 * s, 35 * s);
|
||||
rect2 = rect2 + v2s32(size.X / 2 - 220 * s, ypos);
|
||||
text = wgettext("Register and Join");
|
||||
GUIButton::addButton(Environment, rect2, m_tsrc, this, ID_confirm, text);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect2(0, 0, 120 * s, 35 * s);
|
||||
rect2 = rect2 + v2s32(size.X / 2 + 70 * s, ypos);
|
||||
text = wgettext("Cancel");
|
||||
GUIButton::addButton(Environment, rect2, m_tsrc, this, ID_cancel, text);
|
||||
delete[] text;
|
||||
}
|
||||
ypos += 140 * s;
|
||||
{
|
||||
core::rect<s32> rect2(0, 0, 500 * s, 40 * s);
|
||||
rect2 += topleft_client + v2s32(30 * s, ypos + 40 * s);
|
||||
rect2 += topleft_client + v2s32(30 * s, ypos + 45 * s);
|
||||
text = wgettext("Passwords do not match!");
|
||||
IGUIElement *e = Environment->addStaticText(
|
||||
text, rect2, false, true, this, ID_message);
|
||||
e->setVisible(false);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
ypos += 75 * s;
|
||||
{
|
||||
core::rect<s32> rect2(0, 0, 540 * s, 40 * s);
|
||||
rect2 += topleft_client + v2s32(30 * s, ypos);
|
||||
|
||||
core::rect<s32> bg_middle(10, 10, -10, -10);
|
||||
new GUIBackgroundImage(Environment, this, ID_confirmPasswordBg,
|
||||
rect2, "field_bg.png", bg_middle, m_tsrc, false);
|
||||
|
||||
rect2.UpperLeftCorner.X += 5 * s;
|
||||
rect2.LowerRightCorner.X -= 5 * s;
|
||||
|
||||
gui::IGUIEditBox *e = Environment->addEditBox(m_pass_confirm.c_str(),
|
||||
rect2, true, this, ID_confirmPassword);
|
||||
e->setDrawBorder(false);
|
||||
e->setDrawBackground(false);
|
||||
e->setPasswordBox(true);
|
||||
Environment->setFocus(e);
|
||||
}
|
||||
|
||||
ypos += 60 * s;
|
||||
{
|
||||
core::rect<s32> rect2(0, 0, 300 * s, 40 * s);
|
||||
rect2 = rect2 + v2s32(size.X / 2 - 250 * s, ypos);
|
||||
text = wgettext("Register and Join");
|
||||
GUIButton *e = GUIButton::addButton(Environment, rect2, m_tsrc, this, ID_confirm, text);
|
||||
e->setStyles(StyleSpec::getButtonStyle("", "green"));
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect2(0, 0, 140 * s, 40 * s);
|
||||
rect2 = rect2 + v2s32(size.X / 2 + 110 * s, ypos);
|
||||
text = wgettext("Cancel");
|
||||
GUIButton *e = GUIButton::addButton(Environment, rect2, m_tsrc, this, ID_cancel, text);
|
||||
e->setStyles(StyleSpec::getButtonStyle());
|
||||
delete[] text;
|
||||
}
|
||||
}
|
||||
|
||||
void GUIConfirmRegistration::drawMenu()
|
||||
@ -165,9 +226,10 @@ void GUIConfirmRegistration::drawMenu()
|
||||
if (!skin)
|
||||
return;
|
||||
video::IVideoDriver *driver = Environment->getVideoDriver();
|
||||
v2u32 screensize = driver->getScreenSize();
|
||||
|
||||
video::SColor bgcolor(140, 0, 0, 0);
|
||||
driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);
|
||||
core::rect<s32> allbg(0, 0, screensize.X, screensize.Y);
|
||||
driver->draw2DRectangle(m_fullscreen_bgcolor, allbg, &allbg);
|
||||
|
||||
gui::IGUIElement::draw();
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
|
@ -57,7 +57,10 @@ public:
|
||||
|
||||
private:
|
||||
std::wstring getLabelByID(s32 id) { return L""; }
|
||||
std::string getNameByID(s32 id) { return "password"; }
|
||||
std::string getNameByID(s32 id)
|
||||
{
|
||||
return id == 262 ? "password" : ""; // 262 is ID_confirmPassword
|
||||
}
|
||||
|
||||
Client *m_client = nullptr;
|
||||
const std::string &m_playername;
|
||||
@ -65,4 +68,5 @@ private:
|
||||
bool *m_aborted = nullptr;
|
||||
std::wstring m_pass_confirm = L"";
|
||||
ISimpleTextureSource *m_tsrc;
|
||||
video::SColor m_fullscreen_bgcolor;
|
||||
};
|
||||
|
@ -1606,13 +1606,11 @@ void GUIFormSpecMenu::createTextField(parserData *data, FieldSpec &spec,
|
||||
}
|
||||
|
||||
gui::IGUIEditBox *e = nullptr;
|
||||
static constexpr bool use_intl_edit_box = USE_FREETYPE &&
|
||||
IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9;
|
||||
|
||||
if (use_intl_edit_box && g_settings->getBool("freetype")) {
|
||||
#if USE_FREETYPE && IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9
|
||||
e = new gui::intlGUIEditBox(spec.fdefault.c_str(), true, Environment,
|
||||
data->current_parent, spec.fid, rect, is_editable, is_multiline);
|
||||
} else {
|
||||
#else
|
||||
if (is_multiline) {
|
||||
e = new GUIEditBoxWithScrollBar(spec.fdefault.c_str(), true, Environment,
|
||||
data->current_parent, spec.fid, rect, is_editable, true);
|
||||
@ -1621,7 +1619,7 @@ void GUIFormSpecMenu::createTextField(parserData *data, FieldSpec &spec,
|
||||
data->current_parent, spec.fid);
|
||||
e->grab();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
auto style = getDefaultStyleForElement(is_multiline ? "textarea" : "field", spec.fname);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user