forked from teamnwah/openmw-tes3coop
birthsign tooltip
This commit is contained in:
parent
8d52ee27dc
commit
1c7110fbf5
5 changed files with 85 additions and 3 deletions
|
@ -322,7 +322,7 @@ MyGUI::TextBox* StatsWindow::addValueItem(const std::string& text, const std::st
|
|||
return skillValueWidget;
|
||||
}
|
||||
|
||||
void StatsWindow::addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||
MyGUI::Widget* StatsWindow::addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||
{
|
||||
MyGUI::TextBox* skillNameWidget;
|
||||
|
||||
|
@ -334,6 +334,8 @@ void StatsWindow::addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI
|
|||
|
||||
coord1.top += lineHeight;
|
||||
coord2.top += lineHeight;
|
||||
|
||||
return skillNameWidget;
|
||||
}
|
||||
|
||||
void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||
|
@ -422,7 +424,62 @@ void StatsWindow::updateSkillArea()
|
|||
|
||||
addGroup(mWindowManager.getGameSettingString("sBirthSign", "Sign"), coord1, coord2);
|
||||
const ESM::BirthSign *sign = store.birthSigns.find(birthSignId);
|
||||
addItem(sign->name, coord1, coord2);
|
||||
MyGUI::Widget* w = addItem(sign->name, coord1, coord2);
|
||||
w->setUserString("ToolTipType", "Layout");
|
||||
w->setUserString("ToolTipLayout", "BirthSignToolTip");
|
||||
std::string image = sign->texture;
|
||||
image.replace(image.size()-3, 3, "dds");
|
||||
w->setUserString("ImageTexture_BirthSignImage", "textures\\" + image);
|
||||
std::string text;
|
||||
|
||||
text += sign->name;
|
||||
text += "\n#BF9959" + sign->description;
|
||||
|
||||
std::vector<std::string> abilities, powers, spells;
|
||||
|
||||
std::vector<std::string>::const_iterator it = sign->powers.list.begin();
|
||||
std::vector<std::string>::const_iterator end = sign->powers.list.end();
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
const std::string &spellId = *it;
|
||||
const ESM::Spell *spell = store.spells.search(spellId);
|
||||
if (!spell)
|
||||
continue; // Skip spells which cannot be found
|
||||
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->data.type);
|
||||
if (type != ESM::Spell::ST_Spell && type != ESM::Spell::ST_Ability && type != ESM::Spell::ST_Power)
|
||||
continue; // We only want spell, ability and powers.
|
||||
|
||||
if (type == ESM::Spell::ST_Ability)
|
||||
abilities.push_back(spellId);
|
||||
else if (type == ESM::Spell::ST_Power)
|
||||
powers.push_back(spellId);
|
||||
else if (type == ESM::Spell::ST_Spell)
|
||||
spells.push_back(spellId);
|
||||
}
|
||||
|
||||
struct{ const std::vector<std::string> &spells; std::string label; } categories[3] = {
|
||||
{abilities, "sBirthsignmenu1"},
|
||||
{powers, "sPowers"},
|
||||
{spells, "sBirthsignmenu2"}
|
||||
};
|
||||
|
||||
for (int category = 0; category < 3; ++category)
|
||||
{
|
||||
for (std::vector<std::string>::const_iterator it = categories[category].spells.begin(); it != categories[category].spells.end(); ++it)
|
||||
{
|
||||
if (it == categories[category].spells.begin())
|
||||
{
|
||||
text += std::string("\n#DDC79E") + std::string("#{") + categories[category].label + "}";
|
||||
}
|
||||
|
||||
const std::string &spellId = *it;
|
||||
|
||||
const ESM::Spell *spell = store.spells.search(spellId);
|
||||
text += "\n#BF9959" + spell->name;
|
||||
}
|
||||
}
|
||||
|
||||
w->setUserString("Caption_BirthSignText", text);
|
||||
}
|
||||
|
||||
// Add a line separator if there are items above
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace MWGui
|
|||
void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
MyGUI::TextBox* addValueItem(const std::string& text, const std::string& tooltip, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
MyGUI::Widget* addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void updateScroller();
|
||||
|
||||
void setupToolTips();
|
||||
|
|
|
@ -139,12 +139,16 @@ void ToolTips::onFrame(float frameDuration)
|
|||
MyGUI::TextBox* text = w->castType<MyGUI::TextBox>();
|
||||
tooltipSize.width = std::max(tooltipSize.width, w->getLeft() + text->getTextSize().width + 8);
|
||||
}
|
||||
else
|
||||
tooltipSize.width = std::max(tooltipSize.width, w->getLeft() + w->getWidth() + 8);
|
||||
|
||||
if (w->isUserString("AutoResizeVertical"))
|
||||
{
|
||||
MyGUI::TextBox* text = w->castType<MyGUI::TextBox>();
|
||||
tooltipSize.height = std::max(tooltipSize.height, w->getTop() + text->getTextSize().height + 8);
|
||||
}
|
||||
else
|
||||
tooltipSize.height = std::max(tooltipSize.height, w->getTop() + w->getHeight() + 8);
|
||||
}
|
||||
|
||||
tooltip->setCoord(0, 0, tooltipSize.width, tooltipSize.height);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<MyGUI type="Skin">
|
||||
|
||||
<!-- HTML colour: #DDC79E -->
|
||||
<Skin name = "NormalText" size = "16 16">
|
||||
<Property key="FontName" value = "Default" />
|
||||
<Property key="TextAlign" value = "ALIGN_LEFT ALIGN_BOTTOM" />
|
||||
|
@ -15,6 +17,7 @@
|
|||
<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "ALIGN_STRETCH"/>
|
||||
</Skin>
|
||||
|
||||
<!-- HTML colour: #BF9959 -->
|
||||
<Skin name = "SandText" size = "16 16">
|
||||
<Property key="FontName" value = "Default" />
|
||||
<Property key="TextAlign" value = "ALIGN_LEFT ALIGN_BOTTOM" />
|
||||
|
|
|
@ -28,6 +28,24 @@
|
|||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<!-- Birthsign tooltip -->
|
||||
<Widget type="Widget" skin="HUD_Box" position="0 0 300 300" align="Stretch" name="BirthSignToolTip">
|
||||
<Property key="Visible" value="false"/>
|
||||
|
||||
<!-- 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="ALIGN_LEFT ALIGN_TOP" />
|
||||
</Widget>
|
||||
|
||||
<Widget type="TextBox" skin="NormalText" position="8 154 284 138" align="Top Stretch" name="BirthSignText">
|
||||
<Property key="MultiLine" value="true"/>
|
||||
<Property key="WordWrap" value="true"/>
|
||||
<Property key="TextAlign" value="Top HCenter"/>
|
||||
<UserString key="AutoResizeHorizontal" value="true"/>
|
||||
<UserString key="AutoResizeVertical" value="true"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
</Widget>
|
||||
</MyGUI>
|
||||
|
||||
|
|
Loading…
Reference in a new issue