1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-18 13:12:50 +00:00

show faction & birthsign in the stats window

This commit is contained in:
scrawl 2012-05-19 14:55:09 +02:00
parent 24ce88de2a
commit 7ef0ad4e39
8 changed files with 38 additions and 28 deletions

View File

@ -173,7 +173,6 @@ void CharacterCreation::spawnDialog(const char id)
mWM->removeDialog(mBirthSignDialog);
mBirthSignDialog = new BirthDialog(*mWM);
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
mBirthSignDialog->setBirthId(mPlayerBirthSignId);
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack);
mBirthSignDialog->open();
@ -414,7 +413,6 @@ void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
if (mBirthSignDialog)
{
mPlayerBirthSignId = mBirthSignDialog->getBirthId();
mWM->setBirthSign(mPlayerBirthSignId);
if (!mPlayerBirthSignId.empty())
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mPlayerBirthSignId);
mWM->removeDialog(mBirthSignDialog);

View File

@ -50,12 +50,6 @@ namespace MWGui
getWidget(itemView, "ItemView");
setWidgets(containerWidget, itemView);
mFilterAll->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sAllTab")->str);
mFilterWeapon->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sWeaponTab")->str);
mFilterApparel->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sApparelTab")->str);
mFilterMagic->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sMagicTab")->str);
mFilterMisc->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sMiscTab")->str);
// adjust size of buttons to fit text
int curX = 0;
mFilterAll->setSize( mFilterAll->getTextSize().width + 24, mFilterAll->getSize().height );
@ -227,8 +221,11 @@ namespace MWGui
mEncumbranceText->setCaption( boost::lexical_cast<std::string>(int(encumbrance)) + "/" + boost::lexical_cast<std::string>(int(capacity)) );
}
void InventoryWindow::update()
void InventoryWindow::onFrame()
{
if (!mMainWidget->getVisible())
return;
updateEncumbranceBar();
}

View File

@ -16,7 +16,7 @@ namespace MWGui
/// start trading, disables item drag&drop
void startTrade();
void update();
void onFrame();
int getPlayerGold();

View File

@ -245,11 +245,16 @@ void StatsWindow::configureSkills (const std::vector<int>& major, const std::vec
void StatsWindow::onFrame ()
{
if (mMainWidget->getVisible())
return;
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
MWMechanics::NpcStats PCstats = MWWorld::Class::get(player).getNpcStats(player);
setFactions(PCstats.mFactionRank);
setBirthSign(MWBase::Environment::get().getWorld()->getPlayer().getBirthsign());
if (mChanged)
updateSkillArea();
}
@ -265,7 +270,11 @@ void StatsWindow::setFactions (const FactionList& factions)
void StatsWindow::setBirthSign (const std::string& signId)
{
birthSignId = signId;
if (signId != birthSignId)
{
birthSignId = signId;
mChanged = true;
}
}
void StatsWindow::addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
@ -376,6 +385,10 @@ void StatsWindow::updateSkillArea()
}
skillWidgets.clear();
skillScrollerWidget->setScrollPosition(0);
onScrollChangePosition(skillScrollerWidget, 0);
clientHeight = 0;
const int valueSize = 40;
MyGUI::IntCoord coord1(10, 0, skillClientWidget->getWidth() - (10 + valueSize), 18);
MyGUI::IntCoord coord2(coord1.left + coord1.width, coord1.top, valueSize, coord1.height);

View File

@ -38,8 +38,6 @@ namespace MWGui
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
void configureSkills (const SkillList& major, const SkillList& minor);
void setFactions (const FactionList& factions);
void setBirthSign (const std::string &signId);
void setReputation (int reputation) { this->reputation = reputation; }
void setBounty (int bounty) { this->bounty = bounty; }
void updateSkillArea();
@ -54,6 +52,9 @@ namespace MWGui
void setupToolTips();
void setFactions (const FactionList& factions);
void setBirthSign (const std::string &signId);
void onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos);
void onWindowResize(MyGUI::Window* window);
void onMouseWheel(MyGUI::Widget* _sender, int _rel);

View File

@ -54,7 +54,6 @@ WindowManager::WindowManager(
, playerClass()
, playerName()
, playerRaceId()
, playerBirthSignId()
, playerAttributes()
, playerMajorSkills()
, playerMinorSkills()
@ -395,12 +394,6 @@ void WindowManager::configureSkills (const SkillList& major, const SkillList& mi
playerMinorSkills = minor;
}
void WindowManager::setBirthSign (const std::string &signId)
{
mStatsWindow->setBirthSign (signId);
playerBirthSignId = signId;
}
void WindowManager::setReputation (int reputation)
{
mStatsWindow->setReputation (reputation);
@ -473,7 +466,7 @@ void WindowManager::onFrame (float frameDuration)
mDragAndDrop->mDraggedWidget->setPosition(MyGUI::InputManager::getInstance().getMousePosition());
}
mInventoryWindow->update();
mInventoryWindow->onFrame();
mStatsWindow->onFrame();
}

View File

@ -161,7 +161,6 @@ namespace MWGui
void setPlayerClass (const ESM::Class &class_); ///< set current class of player
void configureSkills (const SkillList& major, const SkillList& minor); ///< configure skill groups, each set contains the skill ID for that group.
void setBirthSign (const std::string &signId); ///< set birth sign to display on stat window, use an empty string to disable.
void setReputation (int reputation); ///< set the current reputation value
void setBounty (int bounty); ///< set the current bounty value
void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty
@ -238,7 +237,6 @@ namespace MWGui
ESM::Class playerClass;
std::string playerName;
std::string playerRaceId;
std::string playerBirthSignId;
std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> > playerAttributes;
SkillList playerMajorSkills, playerMinorSkills;
std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> > playerSkillValues;

View File

@ -35,11 +35,21 @@
<!-- Categories -->
<Widget type="Widget" position="0 8 350 24" align="Left Top HStretch" name="Categories">
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="AllButton"/>
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="WeaponButton"/>
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="ApparelButton"/>
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="MagicButton"/>
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="MiscButton"/>
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="AllButton">
<Property key="Caption" value="#{sAllTab}"/>
</Widget>
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="WeaponButton">
<Property key="Caption" value="#{sWeaponTab}"/>
</Widget>
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="ApparelButton">
<Property key="Caption" value="#{sApparelTab}"/>
</Widget>
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="MagicButton">
<Property key="Caption" value="#{sMagicTab}"/>
</Widget>
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="MiscButton">
<Property key="Caption" value="#{sMiscTab}"/>
</Widget>
</Widget>
</Widget>