mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-14 01:19:59 +00:00
Merge branch 'birthsigntooltip' into 'master'
Revise birthsign tooltip layout (#6792) Closes #6792 See merge request OpenMW/openmw!4558
This commit is contained in:
commit
b3efab88e3
@ -894,7 +894,8 @@ namespace MWGui
|
||||
widget->setUserString("ToolTipLayout", "BirthSignToolTip");
|
||||
widget->setUserString(
|
||||
"ImageTexture_BirthSignImage", Misc::ResourceHelpers::correctTexturePath(sign->mTexture, vfs));
|
||||
std::string text = sign->mName + "\n#{fontcolourhtml=normal}" + sign->mDescription;
|
||||
widget->setUserString("Caption_BirthSignName", sign->mName);
|
||||
widget->setUserString("Caption_BirthSignDescription", sign->mDescription);
|
||||
|
||||
std::vector<const ESM::Spell*> abilities, powers, spells;
|
||||
|
||||
@ -915,26 +916,22 @@ namespace MWGui
|
||||
spells.push_back(spell);
|
||||
}
|
||||
|
||||
using Category = std::pair<const std::vector<const ESM::Spell*>&, std::string_view>;
|
||||
for (const auto& [category, label] : std::initializer_list<Category>{
|
||||
{ abilities, "sBirthsignmenu1" }, { powers, "sPowers" }, { spells, "sBirthsignmenu2" } })
|
||||
using Category = std::tuple<const std::vector<const ESM::Spell*>&, std::string_view, std::string_view>;
|
||||
std::initializer_list<Category> categories{ { abilities, "#{sBirthsignmenu1}", "Abilities" },
|
||||
{ powers, "#{sPowers}", "Powers" }, { spells, "#{sBirthsignmenu2}", "Spells" } };
|
||||
|
||||
for (const auto& [category, label, widgetName] : categories)
|
||||
{
|
||||
bool addHeader = true;
|
||||
for (const ESM::Spell* spell : category)
|
||||
std::string text;
|
||||
if (!category.empty())
|
||||
{
|
||||
if (addHeader)
|
||||
{
|
||||
text += "\n\n#{fontcolourhtml=header}#{";
|
||||
text += label;
|
||||
text += '}';
|
||||
addHeader = false;
|
||||
}
|
||||
|
||||
text += "\n#{fontcolourhtml=normal}" + spell->mName;
|
||||
text = std::string(label) + "\n#{fontcolourhtml=normal}";
|
||||
for (const ESM::Spell* spell : category)
|
||||
text += spell->mName + ' ';
|
||||
text.pop_back();
|
||||
}
|
||||
widget->setUserString("Caption_BirthSign" + std::string(widgetName), text);
|
||||
}
|
||||
|
||||
widget->setUserString("Caption_BirthSignText", text);
|
||||
}
|
||||
|
||||
void ToolTips::createRaceToolTip(MyGUI::Widget* widget, const ESM::Race* playerRace)
|
||||
|
@ -272,16 +272,34 @@
|
||||
</Widget>
|
||||
|
||||
<!-- Birthsign tooltip -->
|
||||
<Widget type="VBox" skin="HUD_Box_NoTransp" position="0 0 300 300" align="Stretch" name="BirthSignToolTip">
|
||||
<Widget type="VBox" skin="HUD_Box_NoTransp" position="0 0 0 0" align="Stretch" name="BirthSignToolTip">
|
||||
<Property key="AutoResize" value="true"/>
|
||||
<Property key="Padding" value="8"/>
|
||||
<Property key="Padding" value="10"/>
|
||||
|
||||
<!-- Birthsign image -->
|
||||
<Widget type="Widget" skin="MW_Box" position="18 13 263 137" align="Top HCenter">
|
||||
<Widget type="ImageBox" skin="ImageBox" position="2 2 259 133" name="BirthSignImage" align="Left Top"/>
|
||||
<Widget type="ImageBox" skin="ImageBox" position="2 2 259 133" name="BirthSignImage" align="Top"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText" position="8 154 284 138" align="Top" name="BirthSignText">
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText" align="Top" name="BirthSignName">
|
||||
<Property key="TextAlign" value="Top HCenter"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="AutoSizedEditBox" skin="SandText" position="0 0 400 100" align="Top" name="BirthSignDescription">
|
||||
<Property key="MultiLine" value="true"/>
|
||||
<Property key="WordWrap" value="true"/>
|
||||
<Property key="TextAlign" value="Left Top"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText" align="Top" name="BirthSignAbilities">
|
||||
<Property key="TextAlign" value="Top HCenter"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText" align="Top" name="BirthSignPowers">
|
||||
<Property key="TextAlign" value="Top HCenter"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText" align="Top" name="BirthSignSpells">
|
||||
<Property key="TextAlign" value="Top HCenter"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user