1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 16:15:31 +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); mWM->removeDialog(mBirthSignDialog);
mBirthSignDialog = new BirthDialog(*mWM); mBirthSignDialog = new BirthDialog(*mWM);
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen); mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
mBirthSignDialog->setBirthId(mPlayerBirthSignId);
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone); mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack); mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack);
mBirthSignDialog->open(); mBirthSignDialog->open();
@ -414,7 +413,6 @@ void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
if (mBirthSignDialog) if (mBirthSignDialog)
{ {
mPlayerBirthSignId = mBirthSignDialog->getBirthId(); mPlayerBirthSignId = mBirthSignDialog->getBirthId();
mWM->setBirthSign(mPlayerBirthSignId);
if (!mPlayerBirthSignId.empty()) if (!mPlayerBirthSignId.empty())
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mPlayerBirthSignId); MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mPlayerBirthSignId);
mWM->removeDialog(mBirthSignDialog); mWM->removeDialog(mBirthSignDialog);

View file

@ -50,12 +50,6 @@ namespace MWGui
getWidget(itemView, "ItemView"); getWidget(itemView, "ItemView");
setWidgets(containerWidget, 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 // adjust size of buttons to fit text
int curX = 0; int curX = 0;
mFilterAll->setSize( mFilterAll->getTextSize().width + 24, mFilterAll->getSize().height ); 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)) ); 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(); updateEncumbranceBar();
} }

View file

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

View file

@ -245,11 +245,16 @@ void StatsWindow::configureSkills (const std::vector<int>& major, const std::vec
void StatsWindow::onFrame () void StatsWindow::onFrame ()
{ {
if (mMainWidget->getVisible())
return;
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
MWMechanics::NpcStats PCstats = MWWorld::Class::get(player).getNpcStats(player); MWMechanics::NpcStats PCstats = MWWorld::Class::get(player).getNpcStats(player);
setFactions(PCstats.mFactionRank); setFactions(PCstats.mFactionRank);
setBirthSign(MWBase::Environment::get().getWorld()->getPlayer().getBirthsign());
if (mChanged) if (mChanged)
updateSkillArea(); updateSkillArea();
} }
@ -265,7 +270,11 @@ void StatsWindow::setFactions (const FactionList& factions)
void StatsWindow::setBirthSign (const std::string& signId) void StatsWindow::setBirthSign (const std::string& signId)
{ {
if (signId != birthSignId)
{
birthSignId = signId; birthSignId = signId;
mChanged = true;
}
} }
void StatsWindow::addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2) void StatsWindow::addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
@ -376,6 +385,10 @@ void StatsWindow::updateSkillArea()
} }
skillWidgets.clear(); skillWidgets.clear();
skillScrollerWidget->setScrollPosition(0);
onScrollChangePosition(skillScrollerWidget, 0);
clientHeight = 0;
const int valueSize = 40; const int valueSize = 40;
MyGUI::IntCoord coord1(10, 0, skillClientWidget->getWidth() - (10 + valueSize), 18); MyGUI::IntCoord coord1(10, 0, skillClientWidget->getWidth() - (10 + valueSize), 18);
MyGUI::IntCoord coord2(coord1.left + coord1.width, coord1.top, valueSize, coord1.height); 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 setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
void configureSkills (const SkillList& major, const SkillList& minor); 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 setReputation (int reputation) { this->reputation = reputation; }
void setBounty (int bounty) { this->bounty = bounty; } void setBounty (int bounty) { this->bounty = bounty; }
void updateSkillArea(); void updateSkillArea();
@ -54,6 +52,9 @@ namespace MWGui
void setupToolTips(); void setupToolTips();
void setFactions (const FactionList& factions);
void setBirthSign (const std::string &signId);
void onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos); void onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos);
void onWindowResize(MyGUI::Window* window); void onWindowResize(MyGUI::Window* window);
void onMouseWheel(MyGUI::Widget* _sender, int _rel); void onMouseWheel(MyGUI::Widget* _sender, int _rel);

View file

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

View file

@ -161,7 +161,6 @@ namespace MWGui
void setPlayerClass (const ESM::Class &class_); ///< set current class of player 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 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 setReputation (int reputation); ///< set the current reputation value
void setBounty (int bounty); ///< set the current bounty value void setBounty (int bounty); ///< set the current bounty value
void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty
@ -238,7 +237,6 @@ namespace MWGui
ESM::Class playerClass; ESM::Class playerClass;
std::string playerName; std::string playerName;
std::string playerRaceId; std::string playerRaceId;
std::string playerBirthSignId;
std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> > playerAttributes; std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> > playerAttributes;
SkillList playerMajorSkills, playerMinorSkills; SkillList playerMajorSkills, playerMinorSkills;
std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> > playerSkillValues; std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> > playerSkillValues;

View file

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