Revise saved game dialog save info layout (#8313)

This commit is contained in:
Alexei Kotov 2025-02-20 22:25:12 +03:00
parent 057c85b710
commit 8634b6c3ac
3 changed files with 24 additions and 12 deletions

View File

@ -43,6 +43,7 @@ namespace MWGui
{
getWidget(mScreenshot, "Screenshot");
getWidget(mCharacterSelection, "SelectCharacter");
getWidget(mCellName, "CellName");
getWidget(mInfoText, "InfoText");
getWidget(mOkButton, "OkButton");
getWidget(mCancelButton, "CancelButton");
@ -390,6 +391,7 @@ namespace MWGui
if (pos == MyGUI::ITEM_NONE || !mCurrentCharacter)
{
mCurrentSlot = nullptr;
mCellName->setCaption({});
mInfoText->setCaption({});
mScreenshot->setImageTexture({});
return;
@ -411,15 +413,19 @@ namespace MWGui
std::stringstream text;
text << Misc::fileTimeToString(mCurrentSlot->mTimeStamp, "%Y.%m.%d %T") << "\n";
const std::string& playerName = mCurrentSlot->mProfile.mPlayerName;
if (!playerName.empty())
text << playerName << "\n";
text << "#{OMWEngine:Level} " << mCurrentSlot->mProfile.mPlayerLevel << "\n";
if (mCurrentSlot->mProfile.mCurrentDay > 0)
text << "#{Calendar:day} " << mCurrentSlot->mProfile.mCurrentDay << "\n";
if (mCurrentSlot->mProfile.mMaximumHealth > 0)
text << "#{OMWEngine:Health} " << static_cast<int>(mCurrentSlot->mProfile.mCurrentHealth) << "/"
<< static_cast<int>(mCurrentSlot->mProfile.mMaximumHealth) << "\n";
text << "#{OMWEngine:Level} " << mCurrentSlot->mProfile.mPlayerLevel << "\n";
text << "#{sCell=" << mCurrentSlot->mProfile.mPlayerCellName << "}\n";
int hour = int(mCurrentSlot->mProfile.mInGameTime.mGameHour);
bool pm = hour >= 12;
if (hour >= 13)
@ -427,20 +433,19 @@ namespace MWGui
if (hour == 0)
hour = 12;
if (mCurrentSlot->mProfile.mCurrentDay > 0)
text << "#{Calendar:day} " << mCurrentSlot->mProfile.mCurrentDay << "\n";
text << mCurrentSlot->mProfile.mInGameTime.mDay << " "
<< MWBase::Environment::get().getWorld()->getTimeManager()->getMonthName(
mCurrentSlot->mProfile.mInGameTime.mMonth)
<< " " << hour << " " << (pm ? "#{Calendar:pm}" : "#{Calendar:am}");
<< " " << hour << " " << (pm ? "#{Calendar:pm}" : "#{Calendar:am}") << "\n";
if (mCurrentSlot->mProfile.mTimePlayed > 0)
{
text << "\n"
<< "#{OMWEngine:TimePlayed}: " << formatTimeplayed(mCurrentSlot->mProfile.mTimePlayed);
text << "#{OMWEngine:TimePlayed}: " << formatTimeplayed(mCurrentSlot->mProfile.mTimePlayed) << "\n";
}
text << Misc::fileTimeToString(mCurrentSlot->mTimeStamp, "%Y.%m.%d %T") << "\n";
mCellName->setCaptionWithReplacing("#{sCell=" + mCurrentSlot->mProfile.mPlayerCellName + "}");
mInfoText->setCaptionWithReplacing(text.str());
// Reset the image for the case we're unable to recover a screenshot

View File

@ -57,6 +57,7 @@ namespace MWGui
bool mSaving;
MyGUI::ComboBox* mCharacterSelection;
MyGUI::EditBox* mCellName;
MyGUI::EditBox* mInfoText;
MyGUI::Button* mOkButton;
MyGUI::Button* mCancelButton;

View File

@ -37,14 +37,20 @@
<Widget type="ImageBox" skin="ImageBox" position="2 2 259 133" name="Screenshot"/>
</Widget>
<Widget type="AutoSizedEditBox" skin="NormalText" position="0 0 263 0" name="CellName">
<Property key="Static" value="true"/>
<Property key="MultiLine" value="true"/>
<Property key="WordWrap" value="true"/>
<Property key="NeedKey" value="false"/>
<Property key="TextAlign" value="Center"/>
</Widget>
<Widget type="AutoSizedEditBox" skin="SandText" position="0 0 263 0" name="InfoText">
<Property key="Static" value="true"/>
<Property key="MultiLine" value="true"/>
<Property key="WordWrap" value="true"/>
<Property key="NeedKey" value="false"/>
</Widget>
</Widget>
</Widget>