skill tooltips

actorid
scrawl 13 years ago
parent 6518eb7794
commit 8ce4727424

@ -296,21 +296,15 @@ void StatsWindow::addGroup(const std::string &label, MyGUI::IntCoord &coord1, My
coord2.top += lineHeight;
}
MyGUI::TextBox* StatsWindow::addValueItem(const std::string& text, const std::string& tooltip, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
MyGUI::TextBox* StatsWindow::addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
{
MyGUI::TextBox *skillNameWidget, *skillValueWidget;
skillNameWidget = skillClientWidget->createWidget<MyGUI::TextBox>("SandText", coord1, MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch);
skillNameWidget->setCaption(text);
skillNameWidget->setUserString("ToolTipType", "Layout");
skillNameWidget->setUserString("ToolTipLayout", "TextToolTip");
skillNameWidget->setUserString("Caption_Text", tooltip);
skillNameWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
skillValueWidget = skillClientWidget->createWidget<MyGUI::TextBox>("SandTextRight", coord2, MyGUI::Align::Right | MyGUI::Align::Top);
skillNameWidget->setUserString("ToolTipType", "Layout");
skillNameWidget->setUserString("ToolTipLayout", "TextToolTip");
skillNameWidget->setUserString("Caption_Text", tooltip);
skillValueWidget->setCaption(value);
skillValueWidget->_setWidgetState(state);
skillValueWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
@ -362,13 +356,34 @@ void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId,
float base = stat.getBase();
float modified = stat.getModified();
const ESM::Skill* skill = mWindowManager.getStore().skills.search(skillId);
assert(skill);
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
const ESM::Attribute* attr = mWindowManager.getStore().attributes.search(skill->data.attribute);
assert(attr);
std::string state = "normal";
if (modified > base)
state = "increased";
else if (modified < base)
state = "decreased";
MyGUI::TextBox* widget = addValueItem(mWindowManager.getGameSettingString(skillNameId, skillNameId), "",
MyGUI::TextBox* widget = addValueItem(mWindowManager.getGameSettingString(skillNameId, skillNameId),
boost::lexical_cast<std::string>(static_cast<int>(modified)), state, coord1, coord2);
for (int i=0; i<2; ++i)
{
skillWidgets[skillWidgets.size()-1-i]->setUserString("ToolTipType", "Layout");
skillWidgets[skillWidgets.size()-1-i]->setUserString("ToolTipLayout", "SkillToolTip");
skillWidgets[skillWidgets.size()-1-i]->setUserString("Caption_SkillName", "#{"+skillNameId+"}");
skillWidgets[skillWidgets.size()-1-i]->setUserString("Caption_SkillDescription", skill->description);
skillWidgets[skillWidgets.size()-1-i]->setUserString("Caption_SkillAttribute", "#{sGoverningAttribute}: #{" + attr->name + "}");
skillWidgets[skillWidgets.size()-1-i]->setUserString("ImageTexture_SkillImage", icon);
skillWidgets[skillWidgets.size()-1-i]->setUserString("Caption_SkillProgressText", "0/100");
skillWidgets[skillWidgets.size()-1-i]->setUserString("Range_SkillProgress", "100");
}
skillWidgetMap[skillId] = widget;
}
}
@ -489,12 +504,25 @@ void StatsWindow::updateSkillArea()
addSeparator(coord1, coord2);
addValueItem(mWindowManager.getGameSettingString("sReputation", "Reputation"),
mWindowManager.getGameSettingString("sSkillsMenuReputationHelp", ""),
boost::lexical_cast<std::string>(static_cast<int>(reputation)), "normal", coord1, coord2);
for (int i=0; i<2; ++i)
{
skillWidgets[skillWidgets.size()-1-i]->setUserString("ToolTipType", "Layout");
skillWidgets[skillWidgets.size()-1-i]->setUserString("ToolTipLayout", "TextToolTip");
skillWidgets[skillWidgets.size()-1-i]->setUserString("Caption_Text", "#{sSkillsMenuReputationHelp}");
}
addValueItem(mWindowManager.getGameSettingString("sBounty", "Bounty"),
mWindowManager.getGameSettingString("sCrimeHelp", ""),
boost::lexical_cast<std::string>(static_cast<int>(bounty)), "normal", coord1, coord2);
for (int i=0; i<2; ++i)
{
skillWidgets[skillWidgets.size()-1-i]->setUserString("ToolTipType", "Layout");
skillWidgets[skillWidgets.size()-1-i]->setUserString("ToolTipLayout", "TextToolTip");
skillWidgets[skillWidgets.size()-1-i]->setUserString("Caption_Text", "#{sCrimeHelp}");
}
clientHeight = coord1.top;
updateScroller();
}

@ -46,7 +46,7 @@ namespace MWGui
void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
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);
MyGUI::TextBox* addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
MyGUI::Widget* addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
void updateScroller();

@ -87,7 +87,7 @@ void ToolTips::onFrame(float frameDuration)
tooltip->setVisible(true);
tooltip->setCoord(0, 0, 300, 300);
tooltipSize = MyGUI::IntSize(0,0);
tooltipSize = MyGUI::IntSize(0, tooltip->getSize().height);
std::map<std::string, std::string> userStrings = focus->getUserStrings();
for (std::map<std::string, std::string>::iterator it = userStrings.begin();
@ -122,10 +122,16 @@ void ToolTips::onFrame(float frameDuration)
if (w->isUserString("AutoResizeVertical"))
{
MyGUI::TextBox* text = w->castType<MyGUI::TextBox>();
tooltipSize.height = std::max(tooltipSize.height, w->getTop() + text->getTextSize().height + 8);
int height = text->getTextSize().height;
if (height > w->getHeight())
{
tooltipSize += MyGUI::IntSize(0, height - w->getHeight());
}
if (height < w->getHeight())
{
tooltipSize -= MyGUI::IntSize(0, w->getHeight() - height);
}
}
else
tooltipSize.height = std::max(tooltipSize.height, w->getTop() + w->getHeight() + 8);
}
tooltip->setCoord(0, 0, tooltipSize.width, tooltipSize.height);

@ -31,6 +31,35 @@ namespace ESM
"sSkillSpeechcraft",
"sSkillHandtohand",
};
const std::string Skill::sIconNames[Length] = {
"combat_block.dds",
"combat_armor.dds",
"combat_mediumarmor.dds",
"combat_heavyarmor.dds",
"combat_blunt.dds",
"combat_longblade.dds",
"combat_axe.dds",
"combat_spear.dds",
"combat_athletics.dds",
"magic_enchant.dds",
"magic_destruction.dds",
"magic_alteration.dds",
"magic_illusion.dds",
"magic_conjuration.dds",
"magic_mysticism.dds",
"magic_restoration.dds",
"magic_alchemy.dds",
"magic_unarmored.dds",
"stealth_security.dds",
"stealth_sneak.dds",
"stealth_acrobatics.dds",
"stealth_lightarmor.dds",
"stealth_shortblade.dds",
"stealth_marksman.dds",
"stealth_mercantile.dds",
"stealth_speechcraft.dds",
"stealth_handtohand.dds",
};
const boost::array<Skill::SkillEnum, Skill::Length> Skill::skillIds = {{
Block,
Armorer,

@ -64,6 +64,7 @@ struct Skill
Length
};
static const std::string sSkillNameIds[Length];
static const std::string sIconNames[Length];
static const boost::array<SkillEnum, Length> skillIds;
void load(ESMReader &esm);

@ -41,6 +41,43 @@
</Widget>
</Widget>
<!-- Skill tooltip -->
<Widget type="Widget" skin="HUD_Box" position="0 0 300 98" align="Stretch" name="SkillToolTip">
<Property key="Visible" value="false"/>
<Widget type="ImageBox" skin="ImageBox" position="8 8 32 32" align="Left Top" name="SkillImage"/>
<Widget type="TextBox" skin="NormalText" position="44 8 252 16" align="Left Top HStretch" name="SkillName">
<Property key="TextAlign" value="Left"/>
<UserString key="AutoResizeHorizontal" value="true"/>
</Widget>
<Widget type="TextBox" skin="SandText" position="44 24 252 16" align="Left Top HStretch" name="SkillAttribute">
<Property key="TextAlign" value="Left"/>
<UserString key="AutoResizeHorizontal" value="true"/>
</Widget>
<Widget type="EditBox" skin="SandText" position="8 44 284 0" align="Left Top Stretch" name="SkillDescription">
<Property key="MultiLine" value="true"/>
<Property key="WordWrap" value="true"/>
<Property key="TextAlign" value="Left Top"/>
<UserString key="AutoResizeHorizontal" value="true"/>
<UserString key="AutoResizeVertical" value="true"/>
</Widget>
<Widget type="TextBox" skin="NormalText" position="8 48 284 18" align="Left Bottom HStretch">
<UserString key="AutoResizeHorizontal" value="true"/>
<Property key="Caption" value="#{sSkillProgress}"/>
<Property key="TextAlign" value="Center"/>
</Widget>
<Widget type="ProgressBar" skin="MW_Progress_Red" position="50 70 200 20" align="HCenter Bottom" name="SkillProgress">
<Widget type="TextBox" skin="ProgressText" position="0 0 200 20" align="Stretch" name="SkillProgressText">
<Property key="TextAlign" value="Center"/>
</Widget>
</Widget>
</Widget>
<!-- Birthsign tooltip -->
<Widget type="Widget" skin="HUD_Box" position="0 0 300 300" align="Stretch" name="BirthSignToolTip">
<Property key="Visible" value="false"/>

Loading…
Cancel
Save