mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-07-10 16:08:15 +00:00
Revert "Refresh localized text on gainFocus for RmlUI menus"
This reverts commit 6399a965d6.
This commit is contained in:
@@ -20,18 +20,6 @@
|
||||
#pragma pop_macro("GetNextSibling")
|
||||
#pragma pop_macro("byte")
|
||||
|
||||
static std::string WStringToUTF8(LPCWSTR wstr)
|
||||
{
|
||||
if (!wstr) return {};
|
||||
size_t wlen = wcslen(wstr);
|
||||
if (wlen == 0) return {};
|
||||
int len = WideCharToMultiByte(CP_UTF8, 0, wstr, (int)wlen, nullptr, 0, nullptr, nullptr);
|
||||
if (len <= 0) return {};
|
||||
std::string result(len, '\0');
|
||||
WideCharToMultiByte(CP_UTF8, 0, wstr, (int)wlen, &result[0], len, nullptr, nullptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData, UILayer *parentLayer)
|
||||
: UIScene(iPad, parentLayer)
|
||||
, m_document(nullptr)
|
||||
@@ -48,7 +36,7 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData,
|
||||
{
|
||||
m_document->Show();
|
||||
|
||||
UpdateLocalizedText();
|
||||
bool bNotInGame = (Minecraft::GetInstance()->level == nullptr);
|
||||
|
||||
// Change Skin: hide if not full version
|
||||
if (!ProfileManager.IsFullVersion())
|
||||
@@ -72,8 +60,7 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData,
|
||||
m_document->GetElementById("credits")->AddEventListener(Rml::EventId::Click, this);
|
||||
|
||||
// Focus first visible button
|
||||
auto* elFirst = m_document->GetElementById("change_skin");
|
||||
if (elFirst) elFirst->Focus();
|
||||
m_document->GetElementById("change_skin")->Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -213,27 +200,8 @@ void UIScene_HelpAndOptionsMenu::updateTooltips()
|
||||
{
|
||||
}
|
||||
|
||||
void UIScene_HelpAndOptionsMenu::UpdateLocalizedText()
|
||||
{
|
||||
if (!m_document)
|
||||
return;
|
||||
|
||||
auto setText = [this](const Rml::String& id, int ids) {
|
||||
auto* el = m_document->GetElementById(id);
|
||||
if (el) el->SetInnerRML(WStringToUTF8(app.GetString(ids)));
|
||||
};
|
||||
|
||||
setText("change_skin", IDS_CHANGE_SKIN);
|
||||
setText("how_to_play", IDS_HOW_TO_PLAY);
|
||||
setText("controls", IDS_CONTROLS);
|
||||
setText("settings", IDS_SETTINGS);
|
||||
setText("credits", IDS_CREDITS);
|
||||
}
|
||||
|
||||
void UIScene_HelpAndOptionsMenu::updateComponents()
|
||||
{
|
||||
UpdateLocalizedText();
|
||||
|
||||
bool bNotInGame = (Minecraft::GetInstance()->level == nullptr);
|
||||
if (bNotInGame)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user